Bug 1465458 - Fix launching downloads without a file extension on Windows. r=mak draft
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Tue, 26 Jun 2018 15:27:36 +0100
changeset 810800 d517312087e7
parent 810712 ca98b6f47b4e
push id114115
push userpaolo.mozmail@amadzone.org
push dateTue, 26 Jun 2018 14:56:02 +0000
reviewersmak
bugs1465458
milestone63.0a1
Bug 1465458 - Fix launching downloads without a file extension on Windows. r=mak MozReview-Commit-ID: 6VYjHM46gZx
toolkit/components/downloads/DownloadIntegration.jsm
--- a/toolkit/components/downloads/DownloadIntegration.jsm
+++ b/toolkit/components/downloads/DownloadIntegration.jsm
@@ -590,17 +590,17 @@ var DownloadIntegration = {
     // handle multiple extensions.
     let fileExtension = null, mimeInfo = null;
     let match = file.leafName.match(/\.([^.]+)$/);
     if (match) {
       fileExtension = match[1];
     }
 
     let isWindowsExe = AppConstants.platform == "win" &&
-      fileExtension.toLowerCase() == "exe";
+      fileExtension && fileExtension.toLowerCase() == "exe";
 
     // Ask for confirmation if the file is executable, except for .exe on
     // Windows where the operating system will show the prompt based on the
     // security zone.  We do this here, instead of letting the caller handle
     // the prompt separately in the user interface layer, for two reasons.  The
     // first is because of its security nature, so that add-ons cannot forget
     // to do this check.  The second is that the system-level security prompt
     // would be displayed at launch time in any case.