Code

Opened 2 years ago

Closed 2 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

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."

Attachments (0)

Change History (2)

comment:1 Changed 2 years ago by jezdez

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

comment:2 Changed 2 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.