mirror of
git://develop.git.wordpress.org/
synced 2025-03-24 05:49:49 +01:00
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. See #54243. Fixes #55177. git-svn-id: https://develop.svn.wordpress.org/trunk@52754 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
dd60c77928
commit
fcd5d3b495
@ -2781,6 +2781,11 @@ function _wp_normalize_relative_css_links( $css, $stylesheet_url ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip if the URL is a data URI.
|
||||
if ( str_starts_with( $src_result, 'data:' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Build the absolute URL.
|
||||
$absolute_url = dirname( $stylesheet_url ) . '/' . $src_result;
|
||||
$absolute_url = str_replace( '/./', '/', $absolute_url );
|
||||
|
@ -236,6 +236,10 @@ class Tests_Dependencies_Styles extends WP_UnitTestCase {
|
||||
'css' => 'clip-path: url(#image1);',
|
||||
'expected' => 'clip-path: url(#image1);',
|
||||
),
|
||||
'Data URIs, shouldn\'t change' => array(
|
||||
'css' => 'img {mask-image: url(\'data:image/svg+xml;utf8,<svg></svg>\');}',
|
||||
'expected' => 'img {mask-image: url(\'data:image/svg+xml;utf8,<svg></svg>\');}',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user