diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php
index cfc80db8ea..e9d44442dc 100644
a
|
b
|
function media_sideload_image( $file, $post_id, $desc = null, $return = 'html' ) |
924 | 924 | // Set variables for storage, fix file filename for query strings. |
925 | 925 | preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches ); |
926 | 926 | if ( ! $matches ) { |
927 | | return new WP_Error( 'image_sideload_failed', __( 'Invalid image URL' ) ); |
| 927 | $image_type = exif_imagetype( $file ); |
| 928 | if ( $image_type ) { |
| 929 | $fileextension = image_type_to_extension( $image_type ); |
| 930 | $matches = array( $fileextension ); |
| 931 | } else { |
| 932 | return new WP_Error( 'image_sideload_failed', __( 'Invalid image URL' ) ); |
| 933 | } |
928 | 934 | } |
929 | 935 | |
930 | 936 | $file_array = array(); |