Make WordPress Core


Ignore:
Timestamp:
08/31/2021 11:56:11 PM (5 years ago)
Author:
desrosj
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.
Merges [51653] to the 5.8 branch.
Fixes #53668.

Location:
branches/5.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.8

  • branches/5.8/src/wp-includes/class-wp-image-editor.php

    r51444 r51706  
    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.