Bug 346994: part 1, remove leading dots from filenames before saving, r=mano, a=dveditz

git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_0_BRANCH@224698 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
gavin%gavinsharp.com
2007-04-18 19:58:33 +00:00
parent 2acc0edbbb
commit a9da234f0d
2 changed files with 7 additions and 0 deletions

View File

@@ -897,6 +897,9 @@ function getNormalizedLeafName(aFile, aDefaultExtension)
// Remove trailing dots and spaces on windows
aFile = aFile.replace(/[\s.]+$/, "");
#endif
// Remove leading dots
aFile = aFile.replace(/^\.+/, "");
// Fix up the file name we're saving to to include the default extension
var i = aFile.lastIndexOf(".");

View File

@@ -248,6 +248,10 @@ nsUnknownContentTypeDialog.prototype = {
if (!aLocalFile || !aLocalFile.exists())
return null;
// Remove any leading periods, since we don't want to save hidden files
// automatically.
aLeafName = aLeafName.replace(/^\.+/, "");
if (aLeafName == "")
aLeafName = "unnamed" + (aFileExt ? "." + aFileExt : "");
aLocalFile.append(aLeafName);