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

WordPress Trac noreply at wordpress.org
Fri Mar 10 23:31:15 UTC 2017


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

Comment (by blobfolio):

 Replying to [comment:155 lukecavanagh]:
 > So I did find the MIME type that worked for '''Microsoft Escel 97-2003
 Format''' files saved out of LibreOffice Calc.
 >
 > '''application/vnd.ms-office'''

 Yeah, that's the hardcoded fallback that is built into PHP's fileinfo.so
 extension. Any Word, Excel, PowerPoint, etc., document that does not
 contain the expected header data for the particular format will resolve as
 `application/vnd.ms-office`.

 That's fine, it is what it is, it is just wrong. And wrong MIME data is
 practically the norm. Haha.

 For me, the question was where ''this'' particular wrongness was coming
 from. PHP uses Apache's mime.types data internally (independent of whether
 Apache server software is installed), and it certainly wasn't coming from
 that. The answer, as I discovered, was that fileinfo.so itself contains a
 set of hardcoded rules specifically for handling Office documents. I'm
 sure there was a historical reason for that, it is just a bit odd.

 Example files to be attached to the ticket in a moment in case you still
 want them. Same file saved three different ways, all just regular XLS (all
 the other Excel formats are a bit outside what @lovelucy was talking
 about). A `fileinfo` scan returns three different answers:

 test-ms.xls: application/vnd.ms-excel
 test-libreoffice.xls: application/vnd.ms-office
 test-xml.xls: application/xml

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


More information about the wp-trac mailing list