Bug 290381 - Save As doesn't work on links containing %23. patch from Caleb <bugs.caleb@gmail.com>, r=mconnor/biesi, sr=neil, a=mtschrep.

git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@180624 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mozilla.mano%sent.com
2005-09-20 00:20:30 +00:00
parent ae8e6f863a
commit a80958fca4

View File

@@ -884,14 +884,15 @@ function getNormalizedLeafName(aFile, aDefaultExtension)
{
if (!aDefaultExtension)
return aFile;
#ifdef XP_WIN
// Remove trailing dots and spaces on windows
aFile = aFile.replace(/[\s.]+$/, "");
#endif
// Fix up the file name we're saving to to include the default extension
const stdURLContractID = "@mozilla.org/network/standard-url;1";
const stdURLIID = Components.interfaces.nsIURL;
var url = Components.classes[stdURLContractID].createInstance(stdURLIID);
url.filePath = aFile;
if (url.fileExtension != aDefaultExtension)
var i = aFile.lastIndexOf(".");
if (aFile.substr(i + 1) != aDefaultExtension)
return aFile + "." + aDefaultExtension;
return aFile;