-
-
Couldn't load subscription status.
- Fork 3.7k
Description
Bug
The problem is that I'm using images in the style attributes for background images and I'm set the image urls with a full url:
<div style="background-image: url('http://test.org/test.png')"></div>
Note that the ' in the url() are properly encoded for HTML attributes. This is when the issue comes, the following regexp only match the not encoded ' and " characters and not the encoded ones. The regexp should be fixed by adding
' => '
" => "
The regexp is in plugins/system/sef/sef.php which used to find image urls in style attributes to fix them to the current site's relative path:
$regex = '#style\s_=\s_'":\s_url\s_(['"]?(?!/|' . $protocols . '|#)([^)\'\"]+)['"]?)#m';
Test:
<div style="background-image: url('http://test.org/test.png')"></div>
Result:
<div style="background-image: url("/my/site/path/'http://test.org/test.png'")"></div>
Desired result: - (Regexp do not match this url.)
<div style="background-image: url('http://test.org/test.png')"></div>