#31858: space outside of parameters are not allowed in path() routes
------------------------------+--------------------------------------
     Reporter:  Kevin Michel  |                    Owner:  nobody
         Type:  Bug           |                   Status:  closed
    Component:  Core (URLs)   |                  Version:  3.1
     Severity:  Normal        |               Resolution:  wontfix
     Keywords:                |             Triage Stage:  Unreviewed
    Has patch:  0             |      Needs documentation:  0
  Needs tests:  0             |  Patch needs improvement:  0
Easy pickings:  0             |                    UI/UX:  0
------------------------------+--------------------------------------

Comment (by Kevin Michel):

 Hi,

 I agree that spaces in URLs are unsafe, and we should urlencode them
 when transmitting or writing URLs, like the browser does automatically.

 However, URLs are urldecoded before reaching the router (which is the
 right thing to do as far as I understand it), the router matches a decoded
 path, which is not really an URL anymore.

 In the WSGI case, the url decoding is done when filling
 `environ['PATH_INFO']`,
 for instance here:
 https://github.com/python/cpython/blob/master/Lib/wsgiref/simple_server.py#L85

 Because of that, it's not possible to try to match the safe "%20" in a
 route
 as if it was an URL.

 I think spaces in URLs are indeed unsafe and invalid but spaces in the
 path for the router are safe and should be allowed.

 Not being able to match all valid paths with a route is a possibility but
 it's
 a bit surprising.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31858#comment:2>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/073.661f17542f33b4c9ca34105acde2f351%40djangoproject.com.

Reply via email to