Drupal alters svg fill paths with base url -> broken svg

Created on 23 October 2014, over 9 years ago
Updated 30 November 2023, 7 months ago

Problem/Motivation

When CSS aggregation is enabled and SVG is imported in css with a fragment URL i.e. # or %23 eg: background: url(#SVGID_1_);

Here, url(#SVGID_1_) gets converted to url(http://domain.com/path/path/#SVGID_1_1) resulting in a broken SVG.

Steps to reproduce

Enable CSS aggregation from /admin/config/development/performance

Use an SVG with a fragment URL. eg: background: url(#SVGID_1_);

Proposed resolution

Ignore fragment URL when building and returning the path of the aggregated stylesheets.

Remaining tasks

Review

Commit

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

None

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
CSS 

Last updated 3 days ago

Created by

🇧🇪Belgium GijsRoge

Live updates comments and jobs are added and updated live.
  • Needs backport to D7

    After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024