#21080: collectstatic post-processing fails for references inside comments
-------------------------------------+-------------------------------------
     Reporter:  shreyas@…            |                    Owner:  Tomáš
                                     |  Zigo
         Type:  Bug                  |                   Status:  assigned
    Component:  contrib.staticfiles  |                  Version:  dev
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  1                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Markus Bertheau):

 FWIW, the current approach of parsing CSS with regexes also doesn't work
 with SVG data inlined as data: URLs when they reference for example
 `<linearGradient id='someid' ...>..</..>   <use fill='url(%23someid)'
 ...></use>`. This is changed to something like
 `fill='url("#someid#someid")'`.

 Two shortcomings here are:

 - double quotes are inserted that weren't there before, breaking the
 quoting of the data:-URL that the svg data is in
 - the doubling of the id fragment.

 Concerning the second problem: I didn't look too far into it, but that
 seems to happen because the font-face branch is triggered
 
https://github.com/django/django/blob/96f55ccf798c7592a1203f798a4dffaf173a9263/django/contrib/staticfiles/storage.py#L131-L142

 It's also at least curious that after line 131 final_url already has any
 fragment hash marks escaped (# -> %23), so urlsplit in line 137 doesn't
 catch it as a fragment.

 The relevant extract of our CSS looks like this:

 .sc_modal .content.branded-bg {
     background-image: url("data:image/svg+xml,%3csvg width='375' [...]
 %3cuse fill='url(%23c)' [...]");
 }

-- 
Ticket URL: <https://code.djangoproject.com/ticket/21080#comment:19>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.0f093ec8c2bb2ec222abb1ae433e7b31%40djangoproject.com.

Reply via email to