[wp-trac] [WordPress Trac] #39550: Some Non-image files fail to upload after 4.7.1

WordPress Trac noreply at wordpress.org
Fri Feb 24 15:43:22 UTC 2017


#39550: Some Non-image files fail to upload after 4.7.1
-------------------------------------+------------------------
 Reporter:  greatislander            |       Owner:  joemcgill
     Type:  defect (bug)             |      Status:  assigned
 Priority:  normal                   |   Milestone:  4.7.3
Component:  Upload                   |     Version:  4.7.1
 Severity:  critical                 |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+------------------------

Comment (by blobfolio):

 Replying to [comment:112 joemcgill]:
 > [attachment:39550.4.diff] Updates the approach from
 [attachment:39550.3.diff] to revalidate any image files that fail to pass
 the image validation step in `wp_check_filetype_and_ext()`.

 The `$real_mime` reset you added to the image bit seems to do the trick!

 I wonder if there's an opportunity to offer to rename a file based on what
 `finfo` reports? Should be non-blocking (i.e. just fallback to leaving the
 file named as was), but if WordPress has an entry for both the file
 extension-derived type and the `$real_mime` and they're different, it
 could do an extension swap (like what happens for images now).

 For that check in particular, we'd want to ignore `application/octet-
 stream` or any type beginning `text/` (or else things would be incorrectly
 renamed all the time), but given two specific types, it could save some
 error log space down the road. Wouldn't work on all servers since type
 detection isn't consistent, but would help sometimes.

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


More information about the wp-trac mailing list