Media: Fix wp_unique_filename() to check for name collisions with all alternate file names when an image may be converted after uploading. This includes possible collinions with pre-existing images whose sub-sizes/thumbnails are regenerated.

Props ianmjones, azaozz.
Fixes #53668.

git-svn-id: https://develop.svn.wordpress.org/trunk@51653 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2021-08-24 20:50:21 +00:00
parent d4abd5ca4a
commit 67f8702477
7 changed files with 269 additions and 39 deletions
+2 -4
View File
@@ -591,13 +591,11 @@ abstract class WP_Image_Editor {
* @return string|false
*/
protected static function get_extension( $mime_type = null ) {
$extensions = explode( '|', array_search( $mime_type, wp_get_mime_types(), true ) );
if ( empty( $extensions[0] ) ) {
if ( empty( $mime_type ) ) {
return false;
}
return $extensions[0];
return wp_get_default_extension_for_mime_type( $mime_type );
}
}