Redirect in search with unicode values crashes

VERIFIED FIXED in 5.8

Status

addons.mozilla.org Graveyard
API
VERIFIED FIXED
8 years ago
2 years ago

People

(Reporter: jbalogh, Assigned: davedash)

Tracking

Details

(Whiteboard: [z][r=clouserw], URL)

(Reporter)

Description

8 years ago
I don't think urls are supposed to have unicode, but it looks like we'll have to deal with this.

Traceback (most recent call last):

 File "/data/virtualenvs_preview/zamboni/lib/python2.6/site-packages/django/core/handlers/base.py", line 101, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/data/amo_python/www/preview/zamboni/apps/api/views.py", line 191, in redirect_view
   (api.CURRENT_VERSION, url))

 File "/data/virtualenvs_preview/zamboni/lib/python2.6/site-packages/django/http/__init__.py", line 444, in __init__
   self['Location'] = redirect_to

 File "/data/virtualenvs_preview/zamboni/lib/python2.6/site-packages/django/http/__init__.py", line 350, in __setitem__
   header, value = self._convert_to_ascii(header, value)

 File "/data/virtualenvs_preview/zamboni/lib/python2.6/site-packages/django/http/__init__.py", line 339, in _convert_to_ascii
   value = value.encode('us-ascii')

UnicodeEncodeError: 'ascii' codec can't encode characters in position 16-20: ordinal not in range(128), HTTP response headers must be in US-ASCII format
-> davedash.  We need this fixed before the API can go live.
Whiteboard: [z] → [z][r?clouserw][gh:davedash/api]
Status: NEW → ASSIGNED
Whiteboard: [z][r?clouserw][gh:davedash/api] → [z][r=clouserw][gh:davedash/api]
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
(Reporter)

Comment 2

8 years ago
New failure: /he/firefox/api/1.2/search/für

Traceback (most recent call last):

 File "/data/virtualenvs_preview/zamboni/lib/python2.6/site-packages/django/core/handlers/base.py", line 101, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/data/amo_python/www/preview/zamboni/apps/api/urls.py", line 9, in <lambda>
   class_view = lambda x: lambda *args, **kwargs: x()(*args, **kwargs)

 File "/data/amo_python/www/preview/zamboni/apps/api/views.py", line 76, in __call__
   return self.process_request(*args, **kwargs)

 File "/data/amo_python/www/preview/zamboni/apps/api/views.py", line 152, in process_request
   query = urllib.unquote(query.encode('ascii'))

UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 1: ordinal not in range(128)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Whiteboard: [z][r=clouserw][gh:davedash/api] → [z]
Status: REOPENED → ASSIGNED
Whiteboard: [z] → [z][r?clouserw][gh:davedash/api]
(In reply to comment #2)
> New failure: /he/firefox/api/1.2/search/für

Oh, somebody wants to sign up for German classes ;)
(Reporter)

Updated

8 years ago
Duplicate of this bug: 553250
Fixed in: http://github.com/jbalogh/zamboni/commit/6bd85c43d93c183e58c20a4cacc02e7537c21acb
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago8 years ago
Resolution: --- → FIXED
Whiteboard: [z][r?clouserw][gh:davedash/api] → [z][r=clouserw]
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.