Make WordPress Core

Changeset 52762


Ignore:
Timestamp:
02/17/2022 05:58:11 PM (2 years ago)
Author:
hellofromTonya
Message:

Script Loader: Prevent normalizing data URIs in _wp_normalize_relative_css_links().

This prevents making data URIs as in mask-image:url('data:image/svg+xml;utf8,<svg... relative to the WordPress installation.

Props staatic.
Merges [52754] to the 5.9 branch.
See #54243.
Fixes #55177.

Location:
branches/5.9
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/5.9

  • branches/5.9/src/wp-includes/script-loader.php

    r52748 r52762  
    27822782            }
    27832783
     2784            // Skip if the URL is a data URI.
     2785            if ( str_starts_with( $src_result, 'data:' ) ) {
     2786                continue;
     2787            }
     2788
    27842789            // Build the absolute URL.
    27852790            $absolute_url = dirname( $stylesheet_url ) . '/' . $src_result;
  • branches/5.9/tests/phpunit/tests/dependencies/styles.php

    r52715 r52762  
    237237                'expected' => 'clip-path: url(#image1);',
    238238            ),
     239            'Data URIs, shouldn\'t change'                 => array(
     240                'css'      => 'img {mask-image: url(\'data:image/svg+xml;utf8,<svg></svg>\');}',
     241                'expected' => 'img {mask-image: url(\'data:image/svg+xml;utf8,<svg></svg>\');}',
     242            ),
    239243        );
    240244    }
Note: See TracChangeset for help on using the changeset viewer.