Make WordPress Core


Ignore:
Timestamp:
09/03/2023 12:49:51 PM (19 months ago)
Author:
SergeyBiryukov
Message:

Upload: Correct duplicate MIME type for .xlsx files generated by Google Docs.

This expands the code block previously added for .docx files to include .xlsx files as well, which are known to have the same issue with finfo_file().

Includes a unit test case for wp_check_filetype_and_ext().

Reference: PHP Bug #77784: mime_content_type() result gets doubled for .xlsx.

Follow-up to [56497].

See #57898.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/functions.php

    r55711 r56510  
    16441644                        ),
    16451645                    ),
     1646                    // Google Docs file for which finfo_file() returns a duplicate mime type.
     1647                    array(
     1648                        DIR_TESTDATA . '/uploads/double-mime-type.docx',
     1649                        'double-mime-type.docx',
     1650                        array(
     1651                            'ext'             => 'docx',
     1652                            'type'            => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
     1653                            'proper_filename' => false,
     1654                        ),
     1655                    ),
    16461656                    // Non-image file with wrong sub-type.
    16471657                    array(
Note: See TracChangeset for help on using the changeset viewer.