Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Unified Diff: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm

Issue 1118813005: Don't create bookmark files on OSX that start with a dot. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add myself to the AUTHORS file Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
index 38b5a4eb096fa65e07d52d5f8fb25f937ec238be..52657553dc5e2d8f4cd1734576d89639834cf7d8 100644
--- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
+++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
@@ -722,11 +722,11 @@ static BOOL FileAlreadyExists(NSURL* base, NSString* name) {
// Takes a destination URL, a suggested file name, & an extension (eg .webloc).
// Returns the complete file name with extension you should use.
-// The name returned will not contain /, : or ?, will not be longer than
-// kMaxNameLength + length of extension, and will not be a file name that
-// already exists in that directory. If necessary it will try appending a space
-// and a number to the name (but before the extension) trying numbers up to and
-// including kMaxIndex.
+// The name returned will not contain /, : or ?, will not start with a dot,
+// will not be longer than kMaxNameLength + length of extension, and will not
+// be a file name that already exists in that directory. If necessary it will
+// try appending a space and a number to the name (but before the extension)
+// trying numbers up to and including kMaxIndex.
// If the function gives up it returns nil.
static NSString* UnusedLegalNameForNewDropFile(NSURL* saveLocation,
NSString *fileName,
@@ -741,6 +741,11 @@ static NSString* UnusedLegalNameForNewDropFile(NSURL* saveLocation,
withString:@"-"];
filteredName = [filteredName stringByReplacingOccurrencesOfString:@"?"
withString:@"-"];
+ filteredName =
+ [filteredName stringByReplacingOccurrencesOfString:@"."
+ withString:@"-"
+ options:0
+ range:NSMakeRange(0,1)];
if ([filteredName length] > kMaxNameLength)
filteredName = [filteredName substringToIndex:kMaxNameLength];
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698