From a80958fca4f05ab8ef93785ec1a676ebf9b62381 Mon Sep 17 00:00:00 2001 From: "mozilla.mano%sent.com" Date: Tue, 20 Sep 2005 00:20:30 +0000 Subject: [PATCH] Bug 290381 - Save As doesn't work on links containing %23. patch from Caleb , 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 --- mozilla/toolkit/content/contentAreaUtils.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/mozilla/toolkit/content/contentAreaUtils.js b/mozilla/toolkit/content/contentAreaUtils.js index 328bed644a6..d2c2bc3f601 100644 --- a/mozilla/toolkit/content/contentAreaUtils.js +++ b/mozilla/toolkit/content/contentAreaUtils.js @@ -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;