Bad file extension when using an HTMLAnchorElement
Categories
(Firefox :: File Handling, defect, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr91 | --- | unaffected |
firefox100 | --- | unaffected |
firefox101 | --- | unaffected |
firefox102 | --- | verified |
People
(Reporter: github.christian, Assigned: enndeakin)
References
(Regression)
Details
(Keywords: regression, Whiteboard: [fidefe-quality-foundation])
Attachments
(2 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0
Steps to reproduce:
I try to save a JSON string in a file, using window.URL.createObjectURL , then passing the ObjectURL to an HTMLAnchorElement with the attribute download set to the desired file name and extension ( see the attached index.html file )
Actual results:
The file is saved but a .json extension is added to the file name and extension so the file have two extensions.
Expected results:
The .json extension must not be added to the file name.
Work fine in Firefox 100 and others browsers.
See also bug 1673061 already created by me for a similar problem in version 84 and solved since.
The actual problem occurs only when the type of the file is 'application/json' (see code in the attached index.html file).
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: File' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2•3 years ago
•
|
||
"Regressed" by bug 1746052. Looks intentional, but admittedly application/json is also kinda special in this case as it can be used with random file extensions AFAIK. NI'ing Neil for details.
Updated•3 years ago
|
Comment 3•3 years ago
|
||
(In reply to github.christian from comment #0)
See also bug 1673061 already created by me for a similar problem in version 84 and solved since.
Should bug 1673061 be closed?
Comment 4•3 years ago
•
|
||
(In reply to Kagami :saschanaz from comment #2)
application/json is also kinda special in this case as it can be used with random file extensions AFAIK. NI'ing Neil for details.
Yeah, we stopped overwriting with .json
in bug 1684183. I don't know why that patchset would have caused us to start doing so again, but I somewhat doubt it's intentional.
Updated•3 years ago
|
Comment 5•3 years ago
|
||
Set release status flags based on info from the regressing bug 1746052
Reporter | ||
Comment 6•3 years ago
|
||
(in reply to :Gijs (he/him) Should bug 1673061 be closed?
For me yes, bug 1673061 can be closed. The bug appears only in the nightly builds of Firefox 84 and not in the final version of Firefox 84.
Updated•3 years ago
|
Comment 7•3 years ago
|
||
The bug has a release status flag that shows some version of Firefox is affected, thus it will be considered confirmed.
Comment 8•3 years ago
|
||
Gijs, could we get a priority/severity set? It's not clear to me if the user impact is potentially significant for the 102 release, thanks!
Assignee | ||
Updated•3 years ago
|
Comment 9•3 years ago
|
||
I can't reproduce the problem so I'm not sure how to prioritize this. Is this Windows-specific? Neil, did you already try to reproduce?
Assignee | ||
Comment 10•3 years ago
|
||
Yes, I can reproduce on Mac at least. I think we can change this to just never change the extension for zip/json/xml which are the three types that were handled in 1684183.
Updated•3 years ago
|
Updated•3 years ago
|
Assignee | ||
Comment 11•3 years ago
|
||
Comment 12•3 years ago
|
||
Neil, can we get this landed before the merge? Thanks
Comment 13•3 years ago
|
||
Comment 14•3 years ago
|
||
bugherder |
Assignee | ||
Updated•3 years ago
|
Updated•3 years ago
|
Assignee | ||
Updated•3 years ago
|
Comment 15•3 years ago
|
||
Reproduced the issue with Firefox 102.0a1 (20220511214930) on Windows 10x64. The downloaded file from the attached test case has .json extension when downloaded.
The issue is verified fixed with Firefox 102.0b3 (20220602190016) on Windows 10x64, macOS 11, and Ubuntu 21.10. The .json extension is no longer added to the downloaded file from the attached test case.
Description
•