зеркало из https://github.com/mozilla/pjs.git
Bug 290381 Save As doesn't work on links containing %23 p=caleb r=biesi sr=me
This commit is contained in:
Родитель
43a2a9b1b5
Коммит
2ecb06625a
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче