If you create a theme with a 2-character name using the color module, the generated styles.css has the wrong path to images.
The problem occurs in _color_rewrite_stylesheet() in the line:
$before = preg_replace('`(^|/)(?!../)([^/]+)/../`', '$1', $before);
If the intention is to simplify paths including '..' (eg /a/b/c/../d to /a/b/d ) then the dots need escaping:
$before = preg_replace('`(^|/)(?!\.\./)([^/]+)/\.\./`', '$1', $before);
Alternatively, don't use two-character theme or directory names ...
Comment | File | Size | Author |
---|---|---|---|
#2 | themes_using_two_chars_break_color_img_rewrite-2879473-2.patch | 634 bytes | Daniel.Moberly |
Comments
Comment #2
Daniel.Moberly CreditAttribution: Daniel.Moberly commentedTested and confirmed this issue exists in Drupal 8 as well.
I believe the intention is to replace paths like
/core/themes/bartik/img/../test.svg
with /core/themes/bartik/test.svg
which is functionally equivalent. However, you are correct that the periods in '../' are not correctly escaped and thus paths like/core/themes/aa/test.svg/
are incorrectly replaced with/core/test.svg
.Attaching a patch for D8.
Comment #3
Daniel.Moberly CreditAttribution: Daniel.Moberly commentedUpdating to a D8 issue
Comment #4
Daniel.Moberly CreditAttribution: Daniel.Moberly commentedComment #6
borisson_This patch still applies, but I think this needs tests. Setting to needs work and adding that tag.
Comment #16
quietone CreditAttribution: quietone at PreviousNext commentedColor has been removed from core, #3270899: Remove Color module from core.