[wp-trac] [WordPress Trac] #64427: Implement WHATWG MIME Sniffing
WordPress Trac
noreply at wordpress.org
Thu Dec 18 00:44:50 UTC 2025
#64427: Implement WHATWG MIME Sniffing
-------------------------+-----------------------------
Reporter: dmsnell | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
WordPress interacts with MIME media types in a number of places in ad-hoc
ways. These tend to perform unique parsing, which means they lack
consistency and correspondence with how browsers parse MIME types.
For reference, the MIME media type is often derived from the HTTP
`Content-Type` header, which contains a type, a subtype, and an optional
list of parameters. A common example is `text/html` indicating HTML,
`image/png` indicating a PNG image, and `application/xhtml+xml` indicating
the XML serialization of HTML.
Discrepancies arise when the supplied type string doesn’t match exactly
the anticipated forms. For example, with parameters or whitespaces:
- `text/html; charset=utf8`
- `text/plain ; charset="utf-8;iso-2022-jp`
For reliable, consistent, and secure parsing, WordPress should implement
the [https://mimesniff.spec.whatwg.org WHATWG MIME Sniffing
specification], which the browsers will implement. This will ensure
agreement between the server and clients on what content type strings
refer to which media types.
== Related tickets
- #45670 sniffing MIME media types based on different rules than a
browser would use
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64427>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list