From df9e7528ca3680bdcfc260373756b6382bd13365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Ko=C5=9Bcielnicki?= Date: Tue, 7 Apr 2015 23:13:17 +0200 Subject: [PATCH] Pass str/bytes instead of unicode/str to urllib.quote On Python 2, passing unicode as the second argument to urllib.quote is a very bad idea - http://bugs.python.org/issue23885 On Python 3, both b'' and '' are fine. --- oauth2_provider/oauth2_backends.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oauth2_provider/oauth2_backends.py b/oauth2_provider/oauth2_backends.py index 2c5fe1cb5..b7a318c93 100644 --- a/oauth2_provider/oauth2_backends.py +++ b/oauth2_provider/oauth2_backends.py @@ -26,7 +26,7 @@ def _get_escaped_full_path(self, request): parsed = list(urlparse(request.get_full_path())) unsafe = set(c for c in parsed[4]).difference(urlencoded) for c in unsafe: - parsed[4] = parsed[4].replace(c, quote(c, safe='')) + parsed[4] = parsed[4].replace(c, quote(c, safe=b'')) return urlunparse(parsed)