mirror of
https://github.com/WordPress/WordPress.git
synced 2025-04-15 00:15:52 +02:00
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:
parent
d8811d591b
commit
95da3826b9
@ -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.
|
// Set variables for storage, fix file filename for query strings.
|
||||||
preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches );
|
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 = array();
|
||||||
$file_array['name'] = basename( $matches[0] );
|
$file_array['name'] = basename( $matches[0] );
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user