[wp-trac] [WordPress Trac] #55177: Normalizing relative CSS links should skip data URIs

WordPress Trac noreply at wordpress.org
Wed Feb 16 10:05:44 UTC 2022

#55177: Normalizing relative CSS links should skip data URIs
 Reporter:  staatic        |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Script Loader  |    Version:  5.9
 Severity:  normal         |   Keywords:
  Focuses:                 |
 The `_wp_normalize_relative_css_links` function introduced in WordPress
 5.9 should skip [https://developer.mozilla.org/en-
 US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs data URIs].

 Currently the following snippet:


 is replaced with:


 breaking the data URI.

 This happened on a clean installation of WordPress 5.9 using the default
 theme (Twenty Twenty-Two). The data URI that got malformed on the homepage
 can be found in `wp-includes/blocks/image/style.css`.

 Adding the following check to `wp-includes/script-loader.php` after line
 2776 fixes the issue:

                         // Skip if the URL is a data URI.
                         if ( str_starts_with( $src_result, 'data:' ) ) {

Ticket URL: <https://core.trac.wordpress.org/ticket/55177>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list