Opened 9 years ago
Closed 9 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 |
Description
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 "./manage.py", line 23, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 445, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 168, in handle
collected = self.collect()
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/management/commands/collectstatic.py", 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 <django.contrib.staticfiles.storage.ManifestStaticFilesStorage 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 by , 9 years ago
| Component: | Core (Management commands) → contrib.staticfiles |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:2 by , 9 years ago
| Has patch: | set |
|---|---|
| Needs tests: | set |
| Patch needs improvement: | set |
| Version: | 1.9 → master |
Version 0, edited 9 years ago by (next)
comment:3 by , 9 years ago
| Cc: | added |
|---|---|
| Owner: | changed from to |
| Status: | new → assigned |
comment:5 by , 9 years ago
| Patch needs improvement: | unset |
|---|---|
| Triage Stage: | Accepted → Ready for checkin |
Note:
See TracTickets
for help on using tickets.
PR