[Django] #25283: ManifestStaticFilesStorage does not works in edge cases while importing url font-face with IE hack

44 views
Skip to first unread message

Django

unread,
Aug 17, 2015, 11:56:59 AM8/17/15
to django-...@googlegroups.com
#25283: ManifestStaticFilesStorage does not works in edge cases while importing url
font-face with IE hack
-------------------------------------+--------------------
Reporter: msaelices | Owner: nobody
Type: Bug | Status: new
Component: contrib.staticfiles | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+--------------------
See http://www.fontspring.com/blog/the-new-bulletproof-font-face-syntax

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.

Django

unread,
Aug 17, 2015, 11:57:10 AM8/17/15
to django-...@googlegroups.com
#25283: ManifestStaticFilesStorage does not works in edge cases while importing url
font-face with IE hack
-------------------------------------+-------------------------------------

Reporter: msaelices | Owner: nobody
Type: Bug | Status: new
Component: contrib.staticfiles | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by msaelices):

* needs_better_patch: => 0
* has_patch: 0 => 1
* needs_tests: => 0
* needs_docs: => 0


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

Django

unread,
Aug 17, 2015, 12:09:56 PM8/17/15
to django-...@googlegroups.com
#25283: ManifestStaticFilesStorage does not works in edge cases while importing url
font-face with IE hack
-------------------------------------+-------------------------------------

Reporter: msaelices | Owner: nobody
Type: Bug | Status: new
Component: contrib.staticfiles | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by msaelices):

Pull request: https://github.com/django/django/pull/5144

--
Ticket URL: <https://code.djangoproject.com/ticket/25283#comment:2>

Django

unread,
Aug 17, 2015, 7:57:43 PM8/17/15
to django-...@googlegroups.com
#25283: ManifestStaticFilesStorage does not works in edge cases while importing url
font-face with IE hack
-------------------------------------+------------------------------------

Reporter: msaelices | Owner: nobody
Type: Bug | Status: new
Component: contrib.staticfiles | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by timgraham):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/25283#comment:3>

Django

unread,
Aug 24, 2015, 8:21:30 AM8/24/15
to django-...@googlegroups.com
#25283: ManifestStaticFilesStorage does not works in edge cases while importing url
font-face with IE hack
-------------------------------------+------------------------------------

Reporter: msaelices | Owner: nobody
Type: Bug | Status: new
Component: contrib.staticfiles | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by timgraham):

* 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>

Django

unread,
Nov 12, 2015, 5:24:10 PM11/12/15
to django-...@googlegroups.com
#25283: ManifestStaticFilesStorage does not works in edge cases while importing url
font-face with IE hack
-------------------------------------+------------------------------------

Reporter: msaelices | Owner: nobody
Type: Bug | Status: new
Component: contrib.staticfiles | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------

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>

Django

unread,
Nov 12, 2015, 5:24:24 PM11/12/15
to django-...@googlegroups.com
#25283: ManifestStaticFilesStorage does not works in edge cases while importing url
font-face with IE hack
-------------------------------------+------------------------------------

Reporter: msaelices | Owner: nobody
Type: Bug | Status: new
Component: contrib.staticfiles | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by jaap3):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/25283#comment:6>

Django

unread,
Nov 12, 2015, 7:31:10 PM11/12/15
to django-...@googlegroups.com
#25283: ManifestStaticFilesStorage does not works in edge cases while importing url
font-face with IE hack
-------------------------------------+------------------------------------
Reporter: msaelices | Owner: nobody
Type: Bug | Status: closed
Component: contrib.staticfiles | Version: 1.8
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* 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>

Reply all
Reply to author
Forward
0 new messages