Opened 13 years ago

Closed 13 years ago

#16966 closed Bug (fixed)

CachedStaticFilesStorage chokes on file references that end with a '#' or '?' character

Reported by: mkai Owned by: nobody
Component: contrib.staticfiles Version: dev
Severity: Normal Keywords: CachedStaticFilesStorage, CachedFilesMixin, collectstatic
Cc: Jannis Leidel Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm using the "bullet proof" font-face syntax as described here: http://www.fontspring.com/blog/the-new-bulletproof-font-face-syntax

It uses two special file references:

url('myfont-webfont.eot?#iefix')
-- for IE support

url('myfont-webfont.svg#svgFontName') format('svg') -- for SVG fonts

During post_process, CachedStaticFilesStorage tries to open these files from disk, including the '?' and/ or '#' characters, which of course fails, and the processing stops.

The desired behavior would be that when trying to open the file from disk during collectstatic, the remainder following a question mark or hash character is stripped ("myfont-webfont.eot"), but that it still gets included into the hashed file ("myfont-webfont.<MD5>.eot?#iefix").

Change History (4)

comment:1 by Aymeric Augustin, 13 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Aymeric Augustin, 13 years ago

If I remember correctly, a unique id is added as query string in references to external files, and this feature should be kept.

However, the fragment can be preserved.

comment:3 by Jannis Leidel, 13 years ago

Actually the unique ID is added to the filename not the querystring.

But other than that you're right, we need to strip the querystring and fragement when trying to access the file but add it later again when rewriting the url() with the filename that includes the hash.

comment:4 by Jannis Leidel, 13 years ago

Resolution: fixed
Status: newclosed

In [17068]:

Fixed #16966 -- Stopped CachedStaticFilesStorage from choking on querystrings and path fragments.

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