Opened 4 years ago

Closed 4 years ago

#17865 closed Bug (fixed)

CachedStaticFilesStorage css rewriter should strip whitespaces from urls

Reported by: kmike 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


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 < object at 0x2ee2350>.

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

Not sure if this is relevant, but anyway: , 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 Changed 4 years ago by jezdez

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

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