Media: Improve verification of MIME file types.

Merges [43988] to trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@44292 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers
2018-12-18 16:34:17 +00:00
parent 07cf8f3073
commit 06f2b3f5bc
2 changed files with 64 additions and 10 deletions
+22 -2
View File
@@ -1301,8 +1301,8 @@ class Tests_Functions extends WP_UnitTestCase {
DIR_TESTDATA . '/formatting/big5.txt',
'big5.jpg',
array(
'ext' => 'jpg',
'type' => 'image/jpeg',
'ext' => false,
'type' => false,
'proper_filename' => false,
),
),
@@ -1316,6 +1316,26 @@ 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,
),
),
);
// Test a few additional file types on single sites.