Add workaround for compatibility on Python 2 where test.cli.test_create_alias expects the URL to be a byte string, broken in d02334bfd5ac.

This commit is contained in:
Jason R. Coombs 2021-02-15 15:13:56 -05:00
parent 6118d1a2d2
commit 939988a042

View File

@ -285,4 +285,8 @@ def escape_path(path):
True
"""
segments = path.split("/")
return "/".join([urllib.parse.quote(unicode_to_url(s)) for s in segments])
result = "/".join([urllib.parse.quote(unicode_to_url(s)) for s in segments])
# fixme: test.cli.test_create_alias fails if it gets Unicode on Python 2
if PY2 and isinstance(result, type(u'')):
result = result.encode('ascii')
return result