Issue Bug Closed

#79572Fix relative URL Path in CSS may fail if svg data inside url()

René Rossi 01/31/17, 14:34 updated 07/18/24, 21:48

Description

Hi,

if there is some SVG Date inside of an background the regexp in line 631 on ResourceCompressor.php seems to fail.

So if there are some thing like:
@
background-image:url(“data:image/svg+xml;charset=utf8,%3Csvg
width=‘396’ height=‘348’ viewBox=‘0 0 396 348’
xmlns=‘http://www.w3.org/2000/svg’
xmlns:xlink=‘http://www.w3.org/1999/xlink’%3E%3Csvg
id=‘application_avi’ data-name=‘Layer 1’ viewBox=‘0 0 48 48’
width=‘48’ height=‘48’ x=‘348’
y=‘144’%3E%3Cdefs%3E%3Cstyle%3E.aacls-1%7Bfill:none%7D.aacls-2%7Bclip-path:url(‘%23aaclip-path’)%7D.aacls-3%7Bfill:%23f6f6f6%7D.aacls-4%7Bfill:%23e0e0e0%7D.aacls-5%7Bclip-path:url(‘%23aaclip-path-2’)%7D.aacls-6%7Bfill:%234c8fc3%7D.aacls-7%7Bclip-path:url(‘%23aaclip-path-3’)”);
@

the regular expression only returns the inner urls and prepends them.
compare here http://www.phpliveregex.com/p/iLr

i think something like this should work better here: http://www.phpliveregex.com/p/iMl

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.