Bug 246131 - Accept image/jpg for compatibility reasons
Summary: Accept image/jpg for compatibility reasons
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: BrowserCompat, InRadar
Depends on:
Blocks:
 
Reported: 2022-10-05 19:32 PDT by Karl Dubost
Modified: 2022-10-07 07:38 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karl Dubost 2022-10-05 19:32:43 PDT
Some servers seems to send JPEG images as `image/jpg`
The correct Content Type is `image/jpeg` per RFC.
https://www.iana.org/assignments/media-types/media-types.xhtml#image
https://www.rfc-editor.org/rfc/rfc2046.html

It may create web compatibility breakages. 
It would be good to assess the level of breakages it creates.

* Both Firefox and Chrome accepts `image/jpg` for displaying JPEG images.
* Safari is downloading the image.
Comment 1 Radar WebKit Bug Importer 2022-10-05 20:10:09 PDT
<rdar://problem/100835192>
Comment 2 Karl Dubost 2022-10-06 02:16:21 PDT
There is history into this:

It seems to be available already on iOS.
https://searchfox.org/wubkat/rev/e8e9be7353991aee7df45aa62f0e0148f16e6f9f/Source/WebCore/platform/MIMETypeRegistry.cpp#74-93
Comment 4 Anne van Kesteren 2022-10-06 09:09:13 PDT
I'm actually surprised we don't resort to sniffing here, but I suppose that's because we're given a MIME type? In that case we probably want to claim support for this MIME type even if it's non-standard. HTML could probably be more specific about the MIME types here. It currently has "A supported image, video, or audio type" in the navigate algorithm which isn't great. (Separately it suggests `image/*` are image MIME types for a different algorithm, but claiming all of them might also not be what we want for navigate or what other browsers implement.)

https://github.com/web-platform-tests/wpt/pull/30403 has some work-in-progress tests for sniffing-related cases where there's also download-vs-display differences.

https://github.com/whatwg/html/issues/7420 discusses a similar issue for XML MIME types.
Comment 5 Chris Dumez 2022-10-06 12:25:07 PDT
Pull request: https://github.com/WebKit/WebKit/pull/5100
Comment 6 EWS 2022-10-07 07:37:59 PDT
Committed 255268@main (0d17dc0c310f): <https://commits.webkit.org/255268@main>

Reviewed commits have been landed. Closing PR #5100 and removing active labels.