xlsm files are changed to xlsx upon download
Categories
(Firefox :: File Handling, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox87 | --- | fixed |
People
(Reporter: m-o-m, Assigned: evilpies)
References
Details
Attachments
(8 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36
Steps to reproduce:
I regularly have Clients complaining that they cannot open my XLSM (Excel) files because they get an error message that the file is corrupt and is in XLSX format - see attached image as an example. It turns out that the culprit is Firefox. It changes file format upon download from XLSM to XLSX which makes the file unreadable in Microsoft Excel. Using Chrome fixes the issue. But this is not what Clients want to hear if they use Firefox. Could I request a fix for this problem please?
Try this simple file as an example: https://xandertestsite.weebly.com/about.html The file is in XLSM format, you can see it when you hover over the download button. There is nearly nothing in the file, just a blank test VBA module and word "test" in one cell on Sheet1 - so not much.
Actual results:
XLSM files get corrupted upon download as Firefox changes file extension to XLSX
Expected results:
XLSM files should keep XLSM format upon download.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 1•4 years ago
|
||
Firefox will try to correct file extension based on the MIME type, i.e the Content-Type advertised by the server. In your case the file has a Conten-Type of application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
. For xlsm the correct MIME type is application/vnd.ms-excel.sheet.macroEnabled.12
. https://docs.microsoft.com/en-ca/archive/blogs/vsofficedeveloper/office-2007-file-format-mime-types-for-http-content-streaming-2
We might adjust our behavior here, but fixing your server might be quicker.
Assignee | ||
Comment 3•4 years ago
|
||
I am not conviced that we have all the correct MIME types and extensions here.
It also extremely hard to figure out what the correct information is.
We should drop this.
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
![]() |
||
Comment 5•4 years ago
|
||
bugherder |
Hi, definitely something is different but unfortunately it still doesn't work. I used today's Firefox Nightly and when I hit the xlsm download button I get a pop-up message which said the file is in xlsm format (which is better than how it worked prior to your fix, as then it straight away said the file is in xlsx format). But as soon as I downloaded the file it changed from XXX.xlsm to XXX.xlsm.xlsx - so Fireforx adding second format to the file.
Assignee | ||
Comment 7•4 years ago
|
||
I can't reproduce this. When using the link at https://xandertestsite.weebly.com/about.html. I get a file called book1.xlsm
. :Gijs could this be a Windows thing?
Comment 8•4 years ago
|
||
(In reply to Tom Schuster [:evilpie] from comment #7)
I can't reproduce this. When using the link at https://xandertestsite.weebly.com/about.html. I get a file called
book1.xlsm
. :Gijs could this be a Windows thing?
I also cannot reproduce this, even on Windows. Tested with 86 beta, so it doesn't even have the fix from this bug.
Can you reproduce with a clean Firefox profile? Does it happen irrespective of whether you pick "save" or "open" in the dialog asking you what to do? Does it happen if you right click the item and pick "save link as", or only if you just click the link, or...?
Reporter | ||
Comment 10•4 years ago
|
||
Reporter | ||
Comment 11•4 years ago
|
||
Reporter | ||
Comment 12•4 years ago
|
||
Reporter | ||
Comment 13•4 years ago
|
||
The plot thickens...
It is a fresh install of Firefox and Firefox Nightly.
On Firefox it doesn't matter whether I click Open with or Save File, I get .xlsx file in the download dialog, and then a .xlsx file gets downloaded. And if I right click the file and select Save As then it also downloads the file as .xlsx.
However, and this is where it gets interesting, on Nightly (updated just now) the download dialog says it is .xlsm file and when I click Save File then it gets downloaded as XXX.xlsm.xlsx (and doesn't work obviously), but when I click Open with then the file downloads just fine as XXX.xlsm and opens in Excel without any issues.
I uploaded a few screen grabs for you.
I run Windows 10, 64bit.
Comment 14•4 years ago
|
||
Marco, do you remember anything that would explain the distinction between open with / save as here, that could help solve this particular mystery (see comment #13 vs comment #7 / comment #8)? Feels like we have more than one bit of code that is trying to fix the extension but because I can't reproduce it's hard to know where that would be coming from...
Comment 15•4 years ago
|
||
Unfortunately I also can't reproduce the problem.
I can't think of many paths that would try to fix the extension.
Excluding add-ons, for which it's still unclear if the testing happened in a clean profile or not (see below), the only other place I can think of is the various helpers in contentAreaUtils.js, in particular I wonder if the file picker may open with a different extension (in case we open it), and also getNormalizedLeafName() helper may appen a second extension.
(In reply to m-o-m from comment #13)
It is a fresh install of Firefox and Firefox Nightly.
Notice a fresh install doesn't mean a fresh profile. Did you test with a newly created profile?
Do you have "Ask me every time" set for downloads, or a default downloads folder? Basically, when you pick save file do we open the file picker, and in that case could you please post a sshot of the file picker when it opens?
It may be also be useful to set browser.download.loglevel to All, and post the logging reported to the browser console when the bug happens.
Comment 16•4 years ago
|
||
(In reply to Marco Bonardo [:mak] from comment #15)
Unfortunately I also can't reproduce the problem.
I can't think of many paths that would try to fix the extension.
I suspect the issue is that we (Marco, Tom, me) don't have Windows software installed which registers the mimetype + file extension differently. The code at https://searchfox.org/mozilla-central/rev/644e42ded761d4f3ce108fa776197730a9a2c535/uriloader/exthandler/nsExternalHelperAppService.cpp#830-831,843-844 determines a file extension based on the primary extension on the mimetype. If the windows registry has an entry for the mimetype in question that uses xlsx
instead of xlsm
, we'll use that there.
Reporter | ||
Comment 17•4 years ago
|
||
It is very strange that you can't reproduce this issue. I get quite a few complaints a month about corrupted xlsx files, so I'm sure it's not just me.
To answer your questions:
- this was the first time I installed Firefox Nightly. So I guess it was a new profile. And I have just created a new profile for Firefox and used it to launch new browser, tried to download the xlsm file, and got the same problems: 1. save as converts to xlsx 2. open also converts to xlsx;
- it was set to save to Downloads. I guess this was the default setting. I have now changed it to 'always ask you where to save files'. That made no real difference unfortunately;
- I've now set browser.download.loglevel to All as requested. Should I just paste the logging after I downloaded the file?
Reporter | ||
Comment 18•4 years ago
|
||
Reporter | ||
Comment 19•4 years ago
|
||
Comment 20•4 years ago
|
||
Thanks, it looks like the manager doesn't log detailed enough information, we should probably augment it. You can disable the logLevel pref, it was not as useful as I hoped.
From the screenshot the only interesting thing I noticed is file extensions are hidden, I tried flipping that Windows pref on, since it's a difference between my system and yours, but I still cannot reproduce. All the rest of the dialog looks perfectly identical to me. So it must be something in the Registry.
Gijs, I think you may have some js snippets to easily grab registry values from the Browser Console, that may be useful here.
At this point may also be worth filing a fresh new bug where we can follow the new investigation more easily, this bug made changes anyway, so it's not good for tracking further changes.
Updated•2 years ago
|
Description
•