From e03da08d2c7bb253a941c19e9e689c1fdfa93c80 Mon Sep 17 00:00:00 2001 From: "edward.lee%engineering.uiuc.edu" Date: Tue, 2 Oct 2007 15:10:39 +0000 Subject: [PATCH] Bug 396477 - DM renames many files with double extension, e.g. filename.exe.exe. r=sdwilsh, a=mconnor git-svn-id: svn://10.0.0.236/trunk@237081 18797224-902f-48f8-a5cc-f745e15eee43 --- .../toolkit/mozapps/downloads/src/nsHelperAppDlg.js.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mozilla/toolkit/mozapps/downloads/src/nsHelperAppDlg.js.in b/mozilla/toolkit/mozapps/downloads/src/nsHelperAppDlg.js.in index 41b10c9e268..fe101f22693 100644 --- a/mozilla/toolkit/mozapps/downloads/src/nsHelperAppDlg.js.in +++ b/mozilla/toolkit/mozapps/downloads/src/nsHelperAppDlg.js.in @@ -256,9 +256,13 @@ nsUnknownContentTypeDialog.prototype = { this.makeFileUnique(aLocalFile); - if (aLocalFile.isExecutable() && !this.mLauncher.targetFile.isExecutable()) { + // Append a file extension if it's an executable that doesn't have one + let ext = "." + this.mLauncher.MIMEInfo.primaryExtension; + let leaf = aLocalFile.leafName; + if (aLocalFile.isExecutable() && + leaf.substring(leaf.length - ext.length) != ext) { var f = aLocalFile.clone(); - aLocalFile.leafName = aLocalFile.leafName + "." + this.mLauncher.MIMEInfo.primaryExtension; + aLocalFile.leafName = leaf + ext; f.remove(false); this.makeFileUnique(aLocalFile);