diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 81738b5c3d..bb7a57f4b5 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -599,7 +599,7 @@ function media_sideload_image($file, $post_id, $desc = null) { // Set variables for storage // fix file filename for query strings - preg_match('/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $file, $matches); + preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches ); $file_array['name'] = basename($matches[0]); $file_array['tmp_name'] = $tmp; diff --git a/wp-admin/press-this.php b/wp-admin/press-this.php index 9d88369c3f..9a6181673a 100644 --- a/wp-admin/press-this.php +++ b/wp-admin/press-this.php @@ -172,7 +172,7 @@ if ( !empty($_REQUEST['ajax']) ) { */ function get_images_from_uri($uri) { $uri = preg_replace('/\/#.+?$/','', $uri); - if ( preg_match('/\.(jpg|jpe|jpeg|png|gif)$/', $uri) && !strpos($uri,'blogger.com') ) + if ( preg_match( '/\.(jpe?g|jpe|gif|png)\b/i', $uri ) && !strpos( $uri, 'blogger.com' ) ) return "'" . esc_attr( html_entity_decode($uri) ) . "'"; $content = wp_remote_fopen($uri); if ( false === $content ) diff --git a/wp-includes/post.php b/wp-includes/post.php index 1841590860..ea4f3d6711 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -4036,7 +4036,7 @@ function wp_attachment_is_image( $post_id = 0 ) { $ext = preg_match('/\.([^.]+)$/', $file, $matches) ? strtolower($matches[1]) : false; - $image_exts = array('jpg', 'jpeg', 'gif', 'png'); + $image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ); if ( 'image/' == substr($post->post_mime_type, 0, 6) || $ext && 'import' == $post->post_mime_type && in_array($ext, $image_exts) ) return true;