diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 87f3fec895..8df5788119 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -2933,6 +2933,7 @@ function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) { array( 'text/plain', 'text/csv', + 'application/csv', 'text/richtext', 'text/tsv', 'text/vtt', @@ -2943,6 +2944,21 @@ function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) { $type = 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 ) { // Special casing for RTF files. if ( ! in_array(