mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Upload: Fix upload failures of common text file types.
This adds some special case handling in 'wp_check_filetype_and_ext()' that prevents some common file types from being blocked based on mismatched MIME checks, which were made more strict in WordPress 5.0.1. Props Kloon, birgire, tellyworth, joemcgill. See #45615. git-svn-id: https://develop.svn.wordpress.org/trunk@44438 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1230,7 +1230,7 @@ class Tests_Functions extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Data profider for test_wp_get_image_mime();
|
||||
* Data provider for test_wp_get_image_mime();
|
||||
*/
|
||||
public function _wp_get_image_mime() {
|
||||
$data = array(
|
||||
@@ -1336,6 +1336,55 @@ class Tests_Functions extends WP_UnitTestCase {
|
||||
'proper_filename' => false,
|
||||
),
|
||||
),
|
||||
// Non-image file not allowed even if it's named like one.
|
||||
array(
|
||||
DIR_TESTDATA . '/export/crazy-cdata.xml',
|
||||
'crazy-cdata.jpg',
|
||||
array(
|
||||
'ext' => false,
|
||||
'type' => false,
|
||||
'proper_filename' => false,
|
||||
),
|
||||
),
|
||||
// Non-image file not allowed if it's named like something else.
|
||||
array(
|
||||
DIR_TESTDATA . '/export/crazy-cdata.xml',
|
||||
'crazy-cdata.doc',
|
||||
array(
|
||||
'ext' => false,
|
||||
'type' => false,
|
||||
'proper_filename' => false,
|
||||
),
|
||||
),
|
||||
// Assorted text/* sample files
|
||||
array(
|
||||
DIR_TESTDATA . '/uploads/test.vtt',
|
||||
'test.vtt',
|
||||
array(
|
||||
'ext' => 'vtt',
|
||||
'type' => 'text/vtt',
|
||||
'proper_filename' => false,
|
||||
),
|
||||
),
|
||||
array(
|
||||
DIR_TESTDATA . '/uploads/test.csv',
|
||||
'test.csv',
|
||||
array(
|
||||
'ext' => 'csv',
|
||||
'type' => 'text/csv',
|
||||
'proper_filename' => false,
|
||||
),
|
||||
),
|
||||
// RTF files.
|
||||
array(
|
||||
DIR_TESTDATA . '/uploads/test.rtf',
|
||||
'test.rtf',
|
||||
array(
|
||||
'ext' => 'rtf',
|
||||
'type' => 'application/rtf',
|
||||
'proper_filename' => false,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
// Test a few additional file types on single sites.
|
||||
|
||||
Reference in New Issue
Block a user