Adjust the RegEx in `wp_check_filetype()` to be aware that query strings are thing that exist sometimes in URLs.

Adds unit tests.

Props voldemortensen.
Fixes #30377.

Built from https://develop.svn.wordpress.org/trunk@30640


git-svn-id: http://core.svn.wordpress.org/trunk@30630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-11-30 06:33:23 +00:00
parent 5352f51516
commit 4718bf4f76
2 changed files with 2 additions and 2 deletions

View File

@ -2049,7 +2049,7 @@ function wp_check_filetype( $filename, $mimes = null ) {
$ext = false; $ext = false;
foreach ( $mimes as $ext_preg => $mime_match ) { foreach ( $mimes as $ext_preg => $mime_match ) {
$ext_preg = '!\.(' . $ext_preg . ')$!i'; $ext_preg = '!\.(' . $ext_preg . ')(\?.*)?$!i';
if ( preg_match( $ext_preg, $filename, $ext_matches ) ) { if ( preg_match( $ext_preg, $filename, $ext_matches ) ) {
$type = $mime_match; $type = $mime_match;
$ext = $ext_matches[1]; $ext = $ext_matches[1];

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.1-beta2-30639'; $wp_version = '4.1-beta2-30640';
/** /**
* 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.