Skip to content

Commit b367ef2

Browse files
committed
Add WIP fix for handling urls with unicode characters.
1 parent c484083 commit b367ef2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

st2common/st2common/router.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from six.moves.urllib import parse as urlparse # pylint: disable=import-error
3030
import webob
3131
from webob import cookies, exc, Request
32-
from webob.compat import url_unquote
32+
from six.moves import urllib
3333

3434
from st2common.exceptions import rbac as rbac_exc
3535
from st2common.exceptions import auth as auth_exc
@@ -239,7 +239,10 @@ def add_spec(self, spec, transforms):
239239
)
240240

241241
def match(self, req):
242-
path = url_unquote(req.path)
242+
# NOTE: webob.url_unquote doesn't work correctly under Python 3 when paths contain non-ascii
243+
# characters. That method supposed to handle Python 2 and Python 3 compatibility, but it
244+
# doesn't work correctly under Python 3.
245+
path = urllib.parse.unquote(req.path)
243246
LOG.debug("Match path: %s", path)
244247

245248
if len(path) > 1 and path.endswith("/"):

0 commit comments

Comments
 (0)