Make WordPress Core


Ignore:
Timestamp:
08/24/2021 08:50:21 PM (3 years ago)
Author:
azaozz
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-image-editor.php

    r51442 r51653  
    592592     */
    593593    protected static function get_extension( $mime_type = null ) {
    594         $extensions = explode( '|', array_search( $mime_type, wp_get_mime_types(), true ) );
    595 
    596         if ( empty( $extensions[0] ) ) {
     594        if ( empty( $mime_type ) ) {
    597595            return false;
    598596        }
    599597
    600         return $extensions[0];
     598        return wp_get_default_extension_for_mime_type( $mime_type );
    601599    }
    602600}
Note: See TracChangeset for help on using the changeset viewer.