diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 53d0073ab5..58a00528a9 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -2373,10 +2373,37 @@ function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) { * This means that common mismatches are forgiven: application/vnd.apple.numbers is often misidentified as application/zip, * and some media files are commonly named with the wrong extension (.mov instead of .mp4) */ - if ( substr( $real_mime, 0, strcspn( $real_mime, '/' ) ) !== substr( $type, 0, strcspn( $type, '/' ) ) ) { $type = $ext = false; } + } elseif ( 'text/plain' === $real_mime ) { + // A few common file types are occasionally detected as text/plain; allow those. + if ( ! in_array( + $type, + array( + 'text/plain', + 'text/csv', + 'text/richtext', + 'text/tsv', + 'text/vtt', + ) + ) + ) { + $type = $ext = false; + } + } elseif ( 'text/rtf' === $real_mime ) { + // Special casing for RTF files. + if ( ! in_array( + $type, + array( + 'text/rtf', + 'text/plain', + 'application/rtf', + ) + ) + ) { + $type = $ext = false; + } } else { if ( $type !== $real_mime ) { /* diff --git a/wp-includes/version.php b/wp-includes/version.php index ed545fd939..642e20de48 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0.3-alpha-44440'; +$wp_version = '5.0.3-alpha-44443'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.