Changeset 56510
- Timestamp:
- 09/03/2023 12:49:51 PM (12 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r56497 r56510 3151 3151 finfo_close( $finfo ); 3152 3152 3153 // finfo_file() returns redudant mime type for Google docs, see #57898. 3154 if ( 'application/vnd.openxmlformats-officedocument.wordprocessingml.documentapplication/vnd.openxmlformats-officedocument.wordprocessingml.document' === $real_mime ) { 3155 $real_mime = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; 3153 $google_docs_types = array( 3154 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 3155 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 3156 ); 3157 3158 foreach ( $google_docs_types as $google_docs_type ) { 3159 /* 3160 * finfo_file() can return duplicate mime type for Google docs, 3161 * this conditional reduces it to a single instance. 3162 * 3163 * @see https://bugs.php.net/bug.php?id=77784 3164 * @see https://core.trac.wordpress.org/ticket/57898 3165 */ 3166 if ( 2 === substr_count( $real_mime, $google_docs_type ) ) { 3167 $real_mime = $google_docs_type; 3168 } 3156 3169 } 3157 3170 -
trunk/tests/phpunit/tests/functions.php
r55711 r56510 1644 1644 ), 1645 1645 ), 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 ), 1646 1656 // Non-image file with wrong sub-type. 1647 1657 array(
Note: See TracChangeset
for help on using the changeset viewer.