[wp-trac] [WordPress Trac] #40175: Upload Validation / MIME Handling
WordPress Trac
noreply at wordpress.org
Thu Jan 17 06:12:05 UTC 2019
#40175: Upload Validation / MIME Handling
-------------------------------------------------+-------------------------
Reporter: blobfolio | Owner: joemcgill
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 5.1
Component: Media | Version: 4.7.3
Severity: major | Resolution:
Keywords: has-unit-tests has-patch needs- | Focuses:
testing early needs-dev-note | administration
-------------------------------------------------+-------------------------
Comment (by pento):
Overall, I like the direction of this solution. 🙂
I think we need to keep the functionality in `wp_maybe_rename_file()`, but
it probably needs a more descriptive name. 😉
Is there a particular reason why the array in `wp_get_file_types()` isn't
keyed the same way as the array in `wp_get_mime_types()`? This would
remove a bunch of duplicate entries. Alternatively, perhaps something like
this structure:
{{{#!php
$mime_map = array(
'jpg' => array(
'mime_types' => array(
'image/jpeg',
'image/pjpeg',
),
'extensions' => array( 'jpg', 'jpeg', 'jpe' ),
),
// ...
);
}}}
The `wp_get_mime_types()` array could be generated from
`wp_get_file_types()`. Even if it's deprecated, we'd want to keep it
updated for a while.
Logistically, I don't think this can be ready for 5.1: it's going to take
a bit of work to integrate it into Core, and I suspect we're going to run
into all sorts of interesting edge cases when plugins work to convert to
it. I think it could easily be committed early to 5.2, though.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40175#comment:50>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list