#26329: StaticFilesStorage permits leading slash, CachedStaticFilesStorage 
doesn't
-------------------------------------+-------------------------------------
     Reporter:  SeanHayes            |                    Owner:  Deacalion
         Type:  Bug                  |                   Status:  assigned
    Component:  contrib.staticfiles  |                  Version:  1.8
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by dsanders11):

 If no one knows of a legitimate use case for absolute paths being passed
 to the static templatetag, it seems like this could be fixed fairly easily
 by raising a `ValueError` in the StaticFileStorage `url` method if the
 path has a leading slash.

 However, while we're on the topic there are some other inconsistencies
 such as for `CachedFileStorage` leading spaces (but no initial slash) in
 DEBUG returns the path with a leading space, where as not in DEBUG chomps
 the leading space. For `StaticFileStorage`  the leading space is always
 URL encoded.

 Seems like a general 'clean_url' method for StaticFileStorage would be
 useful, that strips spaces and raises a `ValueError` for a leading slash.

--
Ticket URL: <https://code.djangoproject.com/ticket/26329#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.2b2ef347c753867dc881493e133ce7af%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to