diff options
author | Moonchild <moonchild@palemoon.org> | 2020-12-15 11:33:29 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-12-15 11:33:29 +0000 |
commit | 78f114fc422f2606265932de161133e2f07a583d (patch) | |
tree | f74fdcc6a24f8be5ed3a6621a958c145896a4160 | |
parent | ac4c22f096c2c8aa2c595ff2f17cfca46ec2b0cc (diff) | |
download | UXP-78f114fc422f2606265932de161133e2f07a583d.tar UXP-78f114fc422f2606265932de161133e2f07a583d.tar.gz UXP-78f114fc422f2606265932de161133e2f07a583d.tar.lz UXP-78f114fc422f2606265932de161133e2f07a583d.tar.xz UXP-78f114fc422f2606265932de161133e2f07a583d.zip |
[toolkit] Handle corner case confusion of downloaded files without extension.
See code comment for details.
-rw-r--r-- | toolkit/components/jsdownloads/src/DownloadIntegration.jsm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm index 984532893..d47ebcd63 100644 --- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm +++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm @@ -717,6 +717,22 @@ this.DownloadIntegration = { return; } +#ifdef XP_WIN + // When a file has no extension, and there's an executable file with the + // same name in the same folder, the Windows shell can get confused. + // For this reason, we show the file in the containing folder instead of + // trying to open it. + // We also don't trust mimeinfo; it could be a type we can forward to a + // system handler, but it could also be an executable type, and we + // don't have an exhaustive list with all of them. + if (!fileExtension) { + // We can't check for the existence of a same-name file with every + // possible executable extension, so this is a catch-all. + this.showContainingDirectory(aDownload.target.path); + return; + } +#endif + // No custom application chosen, let's launch the file with the default // handler. First, let's try to launch it through the MIME service. if (mimeInfo) { |