Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chokes on %c5 in url #1057

Closed
tisdall opened this issue Jul 29, 2013 · 2 comments
Closed

chokes on %c5 in url #1057

tisdall opened this issue Jul 29, 2013 · 2 comments

Comments

@tisdall
Copy link
Contributor

tisdall commented Jul 29, 2013

I filed an issue with webob but this does seems to be an issue with Pyramid.

If there's a "%c5" in a url request I get the error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc5 in position 18: invalid continuation byte. However, the pyramid docs indicate that I should have gotten a pyramid.exceptions.URLDecodeError instead.

I'm using Python 3.3

Here's a full traceback when I just request "/%c5":

Traceback (most recent call last):
  File "/sites/metrics_dev/env/lib/python3.3/site-packages/pyramid/router.py", line 251, in __call__
    response = self.invoke_subrequest(request, use_tweens=True)
  File "/sites/metrics_dev/env/lib/python3.3/site-packages/pyramid/router.py", line 227, in invoke_subrequest
    response = handle_request(request)
  File "/sites/metrics_dev/env/lib/python3.3/site-packages/pyramid_debugtoolbar-1.0.4-py3.3.egg/pyramid_debugtoolbar/toolbar.py", line 108, in toolbar_tween
    list(filter(None, map(request.path.startswith, exclude))) or
  File "/sites/metrics_dev/env/lib/python3.3/site-packages/WebOb-1.2.3-py3.3.egg/webob/request.py", line 486, in path
    bpath = bytes_(self.path_info, self.url_encoding)
  File "/sites/metrics_dev/env/lib/python3.3/site-packages/WebOb-1.2.3-py3.3.egg/webob/descriptors.py", line 68, in fget
    return req.encget(key, encattr=encattr)
  File "/sites/metrics_dev/env/lib/python3.3/site-packages/WebOb-1.2.3-py3.3.egg/webob/request.py", line 167, in encget
    return bytes_(val, 'latin-1').decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc5 in position 1: unexpected end of data
@mcdonc
Copy link
Member

mcdonc commented Aug 10, 2013

In reality this exception is caused by the pyramid debugtoolbar trying to unpack the path before it gets to Pyramid proper. I'll enhance the toolbar so it raises a URLDecodeError in this place. That said, if you take the toolbar out of your configuration, you should get a URLDecodeError from Pyramid.

mcdonc added a commit to Pylons/pyramid_debugtoolbar that referenced this issue Aug 10, 2013
@mcdonc
Copy link
Member

mcdonc commented Aug 10, 2013

I've reconsidered and I now believe an enhancement to webob would be best for this. See Pylons/webob#115. I'm closing this issue now, since I've fixed the pyramid_debugtoolbar issue in master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants