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/tests/phpunit/tests/media.php

    r57019 r57687  
    400400        // #21963, there will be a GUID always, so there will be a URL.
    401401        $this->assertNotEquals( '', $prepped['url'] );
    402         $this->assertSame( site_url( 'wp-includes/images/media/default.png' ), $prepped['icon'] );
     402        $this->assertSame( site_url( 'wp-includes/images/media/default.svg' ), $prepped['icon'] );
    403403
    404404        // Fake a mime.
Note: See TracChangeset for help on using the changeset viewer.