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

WordPress Trac noreply at wordpress.org
Fri Mar 10 17:19:35 UTC 2017


#39963: MIME Alias Handling
-------------------------+------------------------------
 Reporter:  blobfolio    |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Media        |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------

Comment (by blobfolio):

 Even with the patch that landed in 4.7.3 (#39550) a lot of users are still
 running into validation issues. When `fileinfo` returns an incorrect/old
 type, chances are it will be `application/*`, which
 `wp_check_filetype_and_ext()` subjects to the extra testing.

 Thus landing MIME alias handling as a mitigation sooner rather than later
 would be good.

 The database in `wp_get_mime_aliases()` is refreshed at least once
 monthly, and by its nature will need to be re-pushed to the WP Core
 indefinitely (gotta keep pace!). So any edge cases that might still be
 missing now should not be a blocking concern; with 1751 MIMEs at the time
 of this writing, it already addresses most problems people are likely to
 hit.

 '''What I see as blocking:'''

 (1) We need eyes on the functions themselves. Does anyone see any issues
 in format, structure, technique?

 (2) The quickie patch at #40017 needs to land so `exif` fallbacks (for
 environments without `fileinfo`) can be added to
 `wp_check_real_filetype()`.

 (3) Layout feedback. Where should these functions ultimately go? I suggest
 we place the main payload function (`wp_get_mime_aliases()`) in its own
 file because of its size, while moving the others to `wp-
 includes/functions.php`. Those two functions can `require_once` the
 standalone MIME file so we aren't reading such a large file into memory
 unnecessarily.

 With #1-3 out of the way, we can:

 (4) Get a patch together, including a reduction of
 `wp_check_filetype_and_ext()` to remove duplicate behaviors, utilize alias
 checking.

 (5) Add unit tests for the core.

 (6) Profit!

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


More information about the wp-trac mailing list