The {{{collectstatic}}} command fails when the CSS contains something like
this:
{{{
@font-face {
font-family: 'Montserrat';
src: url('../fonts/montserrat-ultralight-webfont.eot');
src: url('../fonts/montserrat-ultralight-webfont.eot?#iefix') format
('embedded-opentype'),
url('../fonts/montserrat-ultralight-
webfont.svg#../fonts/montserratultra_light') format('svg');
font-weight: 100;
font-style: normal;
}
}}}
The reason? The {{{#../fonts/montserratultra_light}}} part of the
{{{url}}} declaration makes {{{ManifestStaticFilesStorage}}} fails to
compute the relative path counting the {{{..}}} and {{{/}}} ocurrences in
the string. See this line:
https://github.com/django/django/blob/4157c502a5202798d0f73645181cb82aa71d34d9/django/contrib/staticfiles/storage.py#L170
--
Ticket URL: <https://code.djangoproject.com/ticket/25283>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* has_patch: 0 => 1
* needs_tests: => 0
* needs_docs: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/25283#comment:1>
Comment (by msaelices):
Pull request: https://github.com/django/django/pull/5144
--
Ticket URL: <https://code.djangoproject.com/ticket/25283#comment:2>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/25283#comment:3>
* needs_better_patch: 0 => 1
* easy: 1 => 0
Comment:
I left some comments for improvement on the pull request. Please uncheck
"Patch needs improvement" when you update it, thanks!
--
Ticket URL: <https://code.djangoproject.com/ticket/25283#comment:4>
Comment (by jaap3):
I've updated the patch with an additional test in this PR
https://github.com/django/django/pull/5642
I didn't add more comments as I have no idea what the rest of the code is
doing, and it seems out of scope for this issue.
--
Ticket URL: <https://code.djangoproject.com/ticket/25283#comment:5>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/25283#comment:6>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"7624fdb9f8ea4cbff407436606998f572898038b" 7624fdb9]:
{{{
#!CommitTicketReference repository=""
revision="7624fdb9f8ea4cbff407436606998f572898038b"
Fixed #25283 -- Fixed collectstatic crash if a URL contains a fragment
with a path.
A @font-face declaration may contain a fragment that looks like a relative
path,
e.g. @font-face { src: url('../fonts/font.svg#../path/like/fragment'); }
In this case, an incorrect path was passed to the storage backend, which
raised
an error that caused collectstatic to crash.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25283#comment:7>