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");

Comments

moonray created an issue. See original summary.

moonray’s picture

The 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?

mikeytown2’s picture

moonray’s picture

Status: Active » Needs review
StatusFileSize
new945 bytes

After reading through the CSS specs it seems that the following patch should work to fix the issue.

Status: Needs review » Needs work

The last submitted patch, 4: advagg-fix_css_path-2685177-3.patch, failed testing.

The last submitted patch, 4: advagg-fix_css_path-2685177-3.patch, failed testing.

mikeytown2’s picture

Status: Needs work » Needs review
StatusFileSize
new790 bytes

Same patch but with the file path fixed

mikeytown2’s picture

Added some tests to this

Status: Needs review » Needs work

The last submitted patch, 8: advagg-fix_css_path-2685177-with-tests-8.patch, failed testing.

The last submitted patch, 8: advagg-fix_css_path-2685177-with-tests-8.patch, failed testing.

mikeytown2’s picture

Status: Needs work » Needs review
StatusFileSize
new5.23 KB

Looks like the quotes are kept due to the spaces being inside them.

Status: Needs review » Needs work

The last submitted patch, 11: advagg-fix_css_path-2685177-with-tests-11.patch, failed testing.

The last submitted patch, 11: advagg-fix_css_path-2685177-with-tests-11.patch, failed testing.

mikeytown2’s picture

Status: Needs work » Needs review
StatusFileSize
new5.31 KB
mikeytown2’s picture

Status: Needs review » Fixed

#14 has been committed.

  • mikeytown2 committed fb9fcf7 on 7.x-2.x authored by moonray
    Issue #2685177 by mikeytown2, moonray: Path replacement in aggregated...
moonray’s picture

That was quick! Thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.