Commit b4b3a1cb by Chad MILLER

LP#936153, After login, redirecting to a URL that contains non-ASCII characters…

LP#936153, After login, redirecting to a URL that contains non-ASCII characters would fail because the naive "str(foo)" scheme used in urllib would use the default system encoding, which we can't trust at all.
parent 691ecea9
......@@ -244,7 +244,11 @@ def login_begin(request, template_name='openid/login.html',
return_to += '&'
else:
return_to += '?'
return_to += urllib.urlencode({redirect_field_name: redirect_to})
# Django gives us Unicode, which is great. We must encode URI. urllib
# dumbly enforces str. We can't trust anything about the default
# encoding inside str(foo) , so we must explicitly make foo a str.
return_to += urllib.urlencode(
{redirect_field_name: redirect_to.encode("UTF-8")})
return render_openid_request(request, openid_request, return_to)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment