Make WordPress Core


Ignore:
Timestamp:
02/21/2024 07:25:18 PM (11 months ago)
Author:
joedolson
Message:

Media: Ensure wp_mine_type_icon() returns expected file type.

Add an argument to wp_mime_type_icon() to control the file type returned. Following [57638], there are two file formats in the media icons directory. Different systems would pull up different files by default dependent on the order loaded into the cached array, causing intermittent test failures and unpredictable behavior.

Function update allows core usages to always return the .svg while maintaining backwards compatibility for any extended usage that expects a .png. Follow up to [57638].

Also handles a missed case in media list view.

Props SergeyBiryukov, sabernhardt, joedolson, antpb.
Fixes #31352.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/deprecated.php

    r57524 r57687  
    19111911        $src = wp_get_attachment_url( $post->ID );
    19121912        $src_file = & $file;
    1913     } elseif ( $src = wp_mime_type_icon( $post->ID ) ) {
     1913    } elseif ( $src = wp_mime_type_icon( $post->ID, '.svg' ) ) {
    19141914        // No thumb, no image. We'll look for a mime-related icon instead.
    19151915
Note: See TracChangeset for help on using the changeset viewer.