mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-08 12:22:34 +00:00
Bug 290381: "Save Link As..." doubles the extension if the link contains an escaped hash/pound (#) sign encoded as %23, patch by Caleb <bugs.caleb@gmail.com>, r=mconnor
This commit is contained in:
parent
a8a03036c3
commit
d6917672bf
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user