Bug 290381 Save As doesn't work on links containing %23 p=caleb r=biesi sr=me

This commit is contained in:
neil%parkwaycc.co.uk 2006-07-29 05:44:27 +00:00
Родитель 43a2a9b1b5
Коммит 2ecb06625a
1 изменённых файлов: 6 добавлений и 7 удалений

Просмотреть файл

@ -842,15 +842,14 @@ function getNormalizedLeafName(aFile, aDefaultExtension)
if (!aDefaultExtension)
return aFile;
// 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;
// Remove trailing dots and spaces on windows
if (/Win/.test(navigator.platform))
aFile = aFile.replace(/[\s.]+$/, "");
if (url.fileExtension != aDefaultExtension) {
// Fix up the file name we're saving to to include the default extension
var i = aFile.lastIndexOf(".");
if (aFile.substr(i + 1) != aDefaultExtension)
return aFile + "." + aDefaultExtension;
}
return aFile;
}