Upload: Add a check in `wp_check_filetype_and_ext()` to account for CSV files having the `application/csv` MIME type.
Previously, the PHP Fileinfo extension used to detect CSV files as `text/plain`. In PHP 8, this has changed, and CSV files are detected as `application/csv`. Follow-up to [44438]. See #50913. Built from https://develop.svn.wordpress.org/trunk@49049 git-svn-id: http://core.svn.wordpress.org/trunk@48811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
eaf325e386
commit
346794bc57
|
@ -2933,6 +2933,7 @@ function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
|
||||||
array(
|
array(
|
||||||
'text/plain',
|
'text/plain',
|
||||||
'text/csv',
|
'text/csv',
|
||||||
|
'application/csv',
|
||||||
'text/richtext',
|
'text/richtext',
|
||||||
'text/tsv',
|
'text/tsv',
|
||||||
'text/vtt',
|
'text/vtt',
|
||||||
|
@ -2943,6 +2944,21 @@ function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
|
||||||
$type = false;
|
$type = false;
|
||||||
$ext = false;
|
$ext = false;
|
||||||
}
|
}
|
||||||
|
} elseif ( 'application/csv' === $real_mime ) {
|
||||||
|
// Special casing for CSV files.
|
||||||
|
if ( ! in_array(
|
||||||
|
$type,
|
||||||
|
array(
|
||||||
|
'text/csv',
|
||||||
|
'text/plain',
|
||||||
|
'application/csv',
|
||||||
|
),
|
||||||
|
true
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
$type = false;
|
||||||
|
$ext = false;
|
||||||
|
}
|
||||||
} elseif ( 'text/rtf' === $real_mime ) {
|
} elseif ( 'text/rtf' === $real_mime ) {
|
||||||
// Special casing for RTF files.
|
// Special casing for RTF files.
|
||||||
if ( ! in_array(
|
if ( ! in_array(
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.6-alpha-49048';
|
$wp_version = '5.6-alpha-49049';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue