[wp-trac] [WordPress Trac] #39963: MIME Alias Handling

WordPress Trac noreply at wordpress.org
Fri Feb 24 19:47:13 UTC 2017


#39963: MIME Alias Handling
-------------------------+-----------------------------
 Reporter:  blobfolio    |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Media        |    Version:
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 WordPress currently only supports a single MIME type for a given
 extension. This is good enough in many cases, but begins to cause problems
 like #39550 when a library references an alternative MIME type (like
 audio/mpeg vs audio/mp3).

 We probably don't want to introduce changes to the basic MIME functions as
 that could have crazy-far-reaching consequences, but we could add a
 `wp_check_mime_alias($filename, $mime, $allowed_mimes)` function, and
 query it in places where validation-by-MIME is happening.

 This would require a comprehensive collection of MIMEs, past, present,
 vernacular, etc. I am actually already maintaining such a database for
 another PHP library that combines results from Nginx, Apache,
 freedesktop.org, and IANA. So let's start from the assumption that the
 necessary data already exists for retrieving all possible MIME types for a
 given extension.

 I can whip up a patch with the added functionality, but wanted to first
 get some feedback on where/how the data should be incorporated (it is a
 rather big list, a PHP array would go on for miles.. I'm keeping it in a
 JSON file currently), and what existing areas might need to plug into
 that.

 @joemcgill, do you have any initial thoughts?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39963>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list