Opened 12 years ago

Closed 12 years ago

#17865 closed Bug (fixed)

CachedStaticFilesStorage css rewriter should strip whitespaces from urls

Reported by: Mikhail Korobov Owned by: nobody
Component: contrib.staticfiles Version: 1.4-beta-1
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have this rule in one of css files (note the extra whitespace in the url):

.b-error-page {
    background: url(../img/bg-error-page.png ) center 0 no-repeat;
}

Browsers handle this fine, collectstatic raises an exception if CachedStaticFilesStorage is used:

ValueError: The file 'img/bg-error-page.png ' could not be found with <django.contrib.staticfiles.storage.CachedStaticFilesStorage object at 0x2ee2350>.

I think css rewriter should just strip whitespaces in such cases.

Not sure if this is relevant, but anyway:
http://www.ietf.org/rfc/rfc3986 , Appendix C: "For robustness, software that accepts user-typed URI should attempt to recognize and strip both delimiters and embedded whitespace."

Change History (2)

comment:1 by Jannis Leidel, 12 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Jannis Leidel, 12 years ago

Resolution: fixed
Status: newclosed

In [17696]:

Fixed #17865 -- Strip whitespaces from the paths when using the CachedStaticFilesStorage backend.

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