css concatenation breaks data: urls

RESOLVED FIXED in Bugzilla 5.0

Status

()

defect
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: glob, Assigned: glob)

Tracking

unspecified
Bugzilla 5.0
Bug Flags:
approval +
approval5.0 +

Details

Attachments

(1 attachment)

using a data: url in css while css concatenation is enabled results in a broken url.

background: #c8c8c8 url("data:image/gif;base64,R0lGODlhKAAoAIAB..");}

becomes

background: #c8c8c8 url(../../skins/contrib/Dusk/data:image/gif;base64,R0lGODlhKAAoAIAB..");}
Attachment #8523869 - Flags: review?(dylan)
Summary: javascript concatenation breaks data: urls → css concatenation breaks data: urls
Comment on attachment 8523869 [details] [diff] [review]
1100368_1.patch

Review of attachment 8523869 [details] [diff] [review]:
-----------------------------------------------------------------

r=dylan

::: Bugzilla/Template.pm
@@ +542,5 @@
>      # directory from the source
>      $url =~ s/(^['"]|['"]$)//g;
> +    if (substr($url, 0, 1) eq '/' || substr($url, 0, 5) eq 'data:') {
> +        return 'url(' . $url . ')';
> +    }

Not that it matters here, but a regex is faster at not-matching than the above construction. (and the above is faster in the case of matching input).
Attachment #8523869 - Flags: review?(dylan) → review+
To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git
   2e000da..f43045d  5.0 -> 5.0

To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git
   a50e8fd..47da91d  master -> master
Status: NEW → RESOLVED
Closed: 5 years ago
Flags: approval5.0+
Flags: approval+
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.