Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
For the following font file include in a CSS file, the path replacement (to fix the relative path to the included file) doesn't work correctly:
src: url("../fonts/fostbook-webfont.svg#Foundry Sterling Book") format("svg");
where this works correctly
src: url("../fonts/fostbook-webfont.svg#FoundrySterlingBook") format("svg");
The resulting code in the aggregated file is:
src: url("../fonts/fostbook-webfont.svg#Foundry Sterling Book") format("svg");
and
src: url("//website.local/sites/all/themes/custom/themename/css/font-awesome/fonts/fostbook-webfont.svg#foundrysterlingbook") format("svg");
Comment | File | Size | Author |
---|---|---|---|
#14 | advagg-fix_css_path-2685177-with-tests-14.patch | 5.31 KB | mikeytown2 |
#11 | advagg-fix_css_path-2685177-with-tests-11.patch | 5.23 KB | mikeytown2 |
#8 | advagg-fix_css_path-2685177-with-tests-8.patch | 5.23 KB | mikeytown2 |
#7 | advagg-fix_css_path-2685177-7.patch | 790 bytes | mikeytown2 |
#4 | advagg-fix_css_path-2685177-3.patch | 945 bytes | moonray |
Comments
Comment #2
moonray CreditAttribution: moonray at Chapter Three commentedThe offending code is the following:
$contents = preg_replace_callback('%url\(\s*+[\'"]?+(?![a-z]++:|/|\#|\%23+)([^\'"()\s]++)[\'"]?+\s*+\)%i', '_advagg_build_css_path', $contents);
I'm hesitant to simply strip the "Don't include space" part of the regex pattern that would make this work. Is there a particular reason to not allow spaces in the url pattern?
Comment #3
mikeytown2 CreditAttribution: mikeytown2 commentedMost likely related to these 4 issues:
#1961340: CSS aggregation breaks file URL rewriting because it abuses it
#2362643: Drupal alters svg fill paths with base url -> broken svg
#258846: CSS aggregation fails to parse some url()'s
#352042: drupal_build_css_cache() cannot deal with a url() statement not surrounded by spaces.
I believe advagg has the correct tests for these so go ahead and create a patch and see if it passes the tests.
Comment #4
moonray CreditAttribution: moonray at Chapter Three commentedAfter reading through the CSS specs it seems that the following patch should work to fix the issue.
Comment #7
mikeytown2 CreditAttribution: mikeytown2 commentedSame patch but with the file path fixed
Comment #8
mikeytown2 CreditAttribution: mikeytown2 commentedAdded some tests to this
Comment #11
mikeytown2 CreditAttribution: mikeytown2 commentedLooks like the quotes are kept due to the spaces being inside them.
Comment #14
mikeytown2 CreditAttribution: mikeytown2 commentedComment #15
mikeytown2 CreditAttribution: mikeytown2 commented#14 has been committed.
Comment #17
moonray CreditAttribution: moonray at Chapter Three commentedThat was quick! Thanks.