[Django] #32218: storage.StaticFilesStorage.post_process substitutes relative URLs in comments

7 views
Skip to first unread message

Django

unread,
Nov 21, 2020, 2:33:32 PM11/21/20
to django-...@googlegroups.com
#32218: storage.StaticFilesStorage.post_process substitutes relative URLs in
comments
-------------------------------------+-------------------------------------
Reporter: Gagan | Owner: Gagan Deep
Deep |
Type: Bug | Status: assigned
Component: | Version: master
contrib.staticfiles |
Severity: Normal | Keywords: static
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
While using {{{ STATICFILES_STORAGE =
'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' }}}
setting, the {{{ collectstatic }}} command was always failing because it
was not able to find a certain file. I am getting the following error:

{{{

ValueError: The file 'netjsongraph/css/lib/"images/ui-
icons_555555_256x240.png"' could not be found with
<django.contrib.staticfiles.storage.ManifestStaticFilesStorage object at
0x7f773b3be520>.

}}}

The peculiar thing to notice is the name of the missing file contains {{{
" }}}. Initially I thought it might me an error in the CSS, but even after
removing all CSS properties using {{{ url() }}} functions, the error was
still there.
The error disappeared only after I removed the comment in the CSS file
which contained {{{ url(%22images%2Fui-icons_555555_256x240.png%22) }}} as
a parameter to some URL.

The {{{ post_process }}} should not try to make substitutions for {{{ url
}}} keyword inside comments. Since it pattern matching is used to make
substitutions, it will be better to process files without comments for
pattern matching.

You can use [https://github.com/openwisp/openwisp-network-
topology/blob/485a97bcc273fc4dfbb53f509f70a4825fab5a0f/openwisp_network_topology/static/netjsongraph/css/lib
/jquery-ui.min.css this CSS file] for reproducing this bug.

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

Django

unread,
Nov 21, 2020, 3:05:12 PM11/21/20
to django-...@googlegroups.com
#32218: storage.StaticFilesStorage.post_process substitutes relative URLs in
comments
-------------------------------------+-------------------------------------
Reporter: Gagan Deep | Owner: Gagan
| Deep
Type: Bug | Status: closed
Component: contrib.staticfiles | Version: master
Severity: Normal | Resolution: duplicate
Keywords: static | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: assigned => closed
* resolution: => duplicate


Comment:

Duplicate of #21080.

--
Ticket URL: <https://code.djangoproject.com/ticket/32218#comment:1>

Reply all
Reply to author
Forward
0 new messages