[wp-trac] [WordPress Trac] #40017: wp_get_image_mime() returns 'application/octet-stream' for non-image files.

WordPress Trac noreply at wordpress.org
Fri Apr 7 13:37:46 UTC 2017


#40017: wp_get_image_mime() returns 'application/octet-stream' for non-image files.
--------------------------------------+------------------------
 Reporter:  blobfolio                 |       Owner:  joemcgill
     Type:  defect (bug)              |      Status:  assigned
 Priority:  normal                    |   Milestone:  4.7.4
Component:  Media                     |     Version:  4.7.1
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+------------------------

Comment (by blobfolio):

 Replying to [comment:15 swissspidy]:
 > I'd probably split `test_wp_get_image_mime()` up into two separate tests
 with one assertion each.

 I moved the assertions to a data provider function and added GIF, PNG, and
 misnamed JPEG to the batch. Should make it easier to extend going forward.

 Speaking of extensions, `image_type_to_mime_type()` is another function
 that will return inconsistent values depending on the PHP version, so for
 the time being I've limited the valid extension tests to the main three
 (which shouldn't vary): JPG, GIF, PNG.

 If/when #39963 gets pushed we can add alias-capable unit tests to match
 `exif` responses for formats like BMP (which could be either of
 `image/bmp` or `image/x-ms-bmp`).

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


More information about the wp-trac mailing list