Bug #4971

Fix unicode issue in requests for authorisation code

Added by Sofia Papagiannaki about 10 years ago. Updated about 10 years ago.

Status:Resolved Start date:01/22/2014
Priority:High Due date:
Assignee:Sofia Papagiannaki % Done:

0%

Category:Astakos Spent time: -
Target version:0.15

Description

GET /oauth2/auth occasionally fail with the following error:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 45-52: ordinal not in range(128)

The scenario that triggers this issue is the following:
The user requests to view the contents of a file that contain unicode characters.
Pithos requests from Astakos an authorisation code.
Astakos before issuing the authorisation code tries unsuccessfully to authenticate the user (the session has expired) so redirects the user to the login page
with the next parameter pointing to the requested url path (including the query parameters).

The reason of the failure is that Astakos uses urllib.urlencode() in order to construct the next parameter
but this method expects data in str format
while the django converts the request query items from the given encoding to unicode.

django.http.request.QueryDict defines its own urlencode() method
so the solution it is proposed is to use this instead.

Associated revisions

Revision 68122bae
Added by Sofia Papagiannaki about 10 years ago

astakos oa2: Fix request authorisation code failures due to unicode issue

If the object to be urlencoded has its own urlencode() method,
use this instead.

Refs: #4971

History

#1 Updated by Sofia Papagiannaki about 10 years ago

  • Status changed from Assigned to Resolved

Also available in: Atom PDF