Opening SVG file types without extension or DTD in Firefox will show the source code instead of the image
Categories
(Firefox :: Downloads Panel, defect, P3)
Tracking
()
People
(Reporter: rdoghi, Unassigned)
References
(Blocks 1 open bug)
Details
[Affected versions]:
Nightly 81.0b5
[Affected platforms]:
Platforms: Ubuntu, Mac OS
[Preconditions]
Reach about:config and set the following pref: browser.download.viewableInternally.enabledTypes = SVG,XML,PDF,WEBP,AVIF
[Steps to reproduce]:
- Launch the Firefox browser and reach https://mime.ty.ax/
- From the preBuilt section > "default content-type, no extension" click the SVG link.
- From the Open File dialog window select "Open in Firefox" and Click OK
Expected Result:
The image file should be opened in a new tab and it should be properly displayed.
Actual Results:
A new tab opens with the source code of the Image file instead of the actual image.
Reporter | ||
Comment 1•4 years ago
|
||
I think this defect should have an S3 severity.
Comment 2•4 years ago
|
||
Unfortunately this happens because the SVG in the example doesn't have a DTD, so Firefox doesn't detect it as XML+SVG, instead displaying it as a plain text document. Though the download has the content type set, this isn't known when loading the from the file://
URL.
This doesn't happen on Windows. When the file is launched we add an extension, which applies any time we do something other than save, but only on Windows.
I think this could be fixed by always (even on non-Windows) adding the extension when aHandleInternally
is set, though this wouldn't fix the more general case of launching the file from the download list if it is saved, and I'm wary of messing with the 17 year old decision to only add the ext on Windows.
This is unlikely to be a major issue, I think we can expect that most SVGs have the proper extension. It does further expose an existing lack of SVG detection, though, which would be relatively hard to encounter otherwise. I agree on S3.
Description
•