Ticket #104 (defect)
Opened 4 years ago
Last modified 1 year ago
Handle Quoted chars in URLs
Status: closed (fixed)
| Reported by: | rdelon | Assigned to: | anonymous |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.1 |
| Component: | CherryPy code | Keywords: | Handle Quoted chars in URL |
| Cc: |
Fixed in changeset [158]
Attachments
Change History
02/07/05 13:05:09: Modified by Python@ivonet.nl
- keywords set to Spaces URL.
- owner changed from rdelon to Ivo.
- version set to devel.
02/07/05 13:46:56: Modified by Python@IvoNet.nl
- attachment _cphttptools.py added.
Version that works with Spaces in URL
02/07/05 15:01:58: Modified by Ivo
- attachment _cphttptools.2.py added.
The 'urllib.unquote' version
02/07/05 15:02:36: Modified by Ivo
- keywords changed from Spaces URL to Handle Quoted chars in URL.
- owner changed from Ivo to anonymous.
- status changed from new to assigned.
Correction...
path = urllib.unquote(path) # Replace quoted chars (eg %20) from url
is the better option. Thanx Carlos
04/12/05 12:07:51: Modified by rdelon
- milestone set to 2.0-final.
04/24/05 11:27:13: Modified by rdelon
- status changed from assigned to closed.
- resolution set to fixed.
- description changed.
05/21/05 20:19:13: Modified by steadicat
- status changed from closed to reopened.
- summary changed from Handle spaces in filenames for static content to Handle Quoted chars in URLs.
- resolution deleted.
- milestone changed from 2.0-final to 2.1.
The fix is incomplete.
The code in question appears twice (yes, code duplication!), and it was only fixed once.
Lines 315-321 in _cphttptools.py:
if path.startswith('/'): # Remove leading slash path = path[1:] if path.endswith('/'): # Remove trailing slash path = path[:-1] path = urllib.unquote(path) # Replace quoted chars (eg %20) from url
Lines 478-481 in _cphttptools.py:
if path.startswith('/'): path = path[1:] # Remove leading slash if path.endswith('/'): path = path[:-1] # Remove trailing slash
URLs should be unquoted in the latter case too.
05/24/05 10:37:25: Modified by steadicat
- status changed from reopened to closed.
- resolution set to fixed.
Fixed in the branch source:branches/ticket-151.
09/09/05 18:21:21: Modified by fumanchu
- description changed.


If you put
path=path.replace('%20','\x20') # Remove transformed spaces (%20) to real space # Handle static directoriesjust above "# Handle static directories" it will work fine