Opened 10 years ago
Closed 10 years ago
#25283 closed Bug (fixed)
ManifestStaticFilesStorage does not works in edge cases while importing url font-face with IE hack
| Reported by: | Manuel Saelices | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.staticfiles | Version: | 1.8 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
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
Change History (7)
comment:1 by , 10 years ago
| Has patch: | set |
|---|
comment:2 by , 10 years ago
comment:3 by , 10 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:4 by , 10 years ago
| Easy pickings: | unset |
|---|---|
| Patch needs improvement: | set |
I left some comments for improvement on the pull request. Please uncheck "Patch needs improvement" when you update it, thanks!
comment:5 by , 10 years ago
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.
comment:6 by , 10 years ago
| Patch needs improvement: | unset |
|---|
Pull request: https://github.com/django/django/pull/5144