Changeset 44438
- Timestamp:
- 01/07/2019 08:47:56 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r44406 r44438 2570 2570 * and some media files are commonly named with the wrong extension (.mov instead of .mp4) 2571 2571 */ 2572 2573 2572 if ( substr( $real_mime, 0, strcspn( $real_mime, '/' ) ) !== substr( $type, 0, strcspn( $type, '/' ) ) ) { 2573 $type = $ext = false; 2574 } 2575 } elseif ( 'text/plain' === $real_mime ) { 2576 // A few common file types are occasionally detected as text/plain; allow those. 2577 if ( ! in_array( $type, array( 2578 'text/plain', 2579 'text/csv', 2580 'text/richtext', 2581 'text/tsv', 2582 'text/vtt', 2583 ) ) 2584 ) { 2585 $type = $ext = false; 2586 } 2587 } elseif( 'text/rtf' === $real_mime ) { 2588 // Special casing for RTF files. 2589 if ( ! in_array( $type, array( 2590 'text/rtf', 2591 'text/plain', 2592 'application/rtf', 2593 ) ) 2594 ) { 2574 2595 $type = $ext = false; 2575 2596 } -
trunk/tests/phpunit/tests/functions.php
r44292 r44438 1231 1231 1232 1232 /** 1233 * Data pro fider for test_wp_get_image_mime();1233 * Data provider for test_wp_get_image_mime(); 1234 1234 */ 1235 1235 public function _wp_get_image_mime() { … … 1334 1334 'ext' => false, 1335 1335 'type' => false, 1336 'proper_filename' => false, 1337 ), 1338 ), 1339 // Non-image file not allowed even if it's named like one. 1340 array( 1341 DIR_TESTDATA . '/export/crazy-cdata.xml', 1342 'crazy-cdata.jpg', 1343 array( 1344 'ext' => false, 1345 'type' => false, 1346 'proper_filename' => false, 1347 ), 1348 ), 1349 // Non-image file not allowed if it's named like something else. 1350 array( 1351 DIR_TESTDATA . '/export/crazy-cdata.xml', 1352 'crazy-cdata.doc', 1353 array( 1354 'ext' => false, 1355 'type' => false, 1356 'proper_filename' => false, 1357 ), 1358 ), 1359 // Assorted text/* sample files 1360 array( 1361 DIR_TESTDATA . '/uploads/test.vtt', 1362 'test.vtt', 1363 array( 1364 'ext' => 'vtt', 1365 'type' => 'text/vtt', 1366 'proper_filename' => false, 1367 ), 1368 ), 1369 array( 1370 DIR_TESTDATA . '/uploads/test.csv', 1371 'test.csv', 1372 array( 1373 'ext' => 'csv', 1374 'type' => 'text/csv', 1375 'proper_filename' => false, 1376 ), 1377 ), 1378 // RTF files. 1379 array( 1380 DIR_TESTDATA . '/uploads/test.rtf', 1381 'test.rtf', 1382 array( 1383 'ext' => 'rtf', 1384 'type' => 'application/rtf', 1336 1385 'proper_filename' => false, 1337 1386 ),
Note: See TracChangeset
for help on using the changeset viewer.