Bug 1593280 - Follow-up: Restore comment. rs=comment-only
authorJorg K <jorgk@jorgk.com>
Wed, 06 Nov 2019 10:47:41 +0100
changeset 36387 31b98fe6d92329ed73e0c03cd373f20da3b27c7e
parent 36386 308f336efa3e4a31950e84ced994917e1fb02146
child 36388 162757dcb4cd49e973ce0282ec70adde85f22a84
push id2522
push usermozilla@jorgk.com
push dateWed, 06 Nov 2019 17:55:19 +0000
treeherdercomm-beta@162757dcb4cd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscomment-only
bugs1593280
Bug 1593280 - Follow-up: Restore comment. rs=comment-only
mail/base/content/mailWidgets.js
--- a/mail/base/content/mailWidgets.js
+++ b/mail/base/content/mailWidgets.js
@@ -1599,16 +1599,23 @@
         item.setAttribute("image16", base + "attachment-deleted.png");
         item.setAttribute("image32", base + "attachment-deleted-large.png");
       } else {
         let iconName = attachment.name;
         if (iconName.toLowerCase().endsWith(".eml")) {
           // Discard message names derived from crazy subject headers.
           iconName = "message.eml";
         } else if (attachment.url) {
+          // For local file urls, we are better off using the full file url
+          // because moz-icon will actually resolve the file url and get the
+          // right icon from the file url. All other urls, we should try to
+          // extract the file name from them. This fixes issues where an icon
+          // wasn't showing up if you dragged a web url that had a query or
+          // reference string after the file name and for mailnews urls where
+          // the filename is hidden in the url as a &filename=  part.
           let url = Services.io.newURI(attachment.url);
           if (
             url instanceof Ci.nsIURL &&
             url.fileName &&
             !url.schemeIs("file")
           ) {
             iconName = url.fileName;
           }