Opened 6 years ago

Closed 6 years ago

#26671 closed Bug (fixed)

`ManifestStaticFilesStorage` does not work for CSS with URLs including `chrome` scheme

Reported by: Tai Lee Owned by: Deepak Sattiraju
Component: contrib.staticfiles Version: dev
Severity: Normal Keywords: ManifestStaticFilesStorage chrome scheme
Cc: dsattiraju249@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


One of the 3rd party CSS files used by our project contains CSS like this:

.sourceRow[exe_line="true"] > .sourceLine {
    background-image: url(chrome://firebug/skin/exe.png);
    color: #000000;

This causes ManifestStaticFilesStorage to crash with:

Post-processing 'lodash/vendor/firebug-lite/skin/xp/debugger.css' failed!
Traceback (most recent call last):
  File "./", line 23, in <module>
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/", line 354, in execute_from_command_line
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/", line 346, in execute
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/", line 445, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/management/commands/", line 168, in handle
    collected = self.collect()
  File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/management/commands/", line 120, in collect
    raise processed
ValueError: The file 'lodash/vendor/firebug-lite/skin/xp/chrome:/firebug/skin/exe.png' could not be found with < object at 0x7faab0f72950>.

Looks like this .startswith() call needs to change to a regex, or at least include a few more known schemes:

            if url.startswith(('http:', 'https:', '//', '#', 'data:')):
                return matched

Something like this should do the trick (very briefly tested in interactive shell):

            if re.match(r'(?i)([a-z]+://|//|#|data:)', url):
                return matched

Change History (6)

comment:1 Changed 6 years ago by Tim Graham

Component: Core (Management commands)contrib.staticfiles
Triage Stage: UnreviewedAccepted

comment:2 Changed 6 years ago by Simon Charette

Has patch: set
Needs tests: set
Patch needs improvement: set
Version: 1.9master
Last edited 6 years ago by Deepak Sattiraju (previous) (diff)

comment:3 Changed 6 years ago by Deepak Sattiraju

Cc: dsattiraju249@… added
Owner: changed from nobody to Deepak Sattiraju
Status: newassigned

comment:4 Changed 6 years ago by Tim Graham

Needs tests: unset

Updated PR with a few comments for improvement.

comment:5 Changed 6 years ago by Tim Graham

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:6 Changed 6 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 08ed3cc6:

Fixed #26671 -- Made HashedFilesMixin ignore the 'chrome' scheme.

Note: See TracTickets for help on using tickets.
Back to Top