Media: Return early from media_sideload_image() if $file didn't match the pattern for images.

Props MikeHansenMe, serpent7776.
Fixes #32755.
Built from https://develop.svn.wordpress.org/trunk@34984


git-svn-id: http://core.svn.wordpress.org/trunk@34949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2015-10-09 04:46:24 +00:00
parent d8811d591b
commit 95da3826b9
2 changed files with 5 additions and 1 deletions

View File

@ -847,6 +847,10 @@ function media_sideload_image( $file, $post_id, $desc = null, $return = 'html' )
// Set variables for storage, fix file filename for query strings.
preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches );
if ( ! $matches ) {
return new WP_Error( 'image_sideload_failed', __( 'Invalid image URL' ) );
}
$file_array = array();
$file_array['name'] = basename( $matches[0] );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34983';
$wp_version = '4.4-alpha-34984';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.