Merge commit '2fb603e60' into 3603.scripts

This commit is contained in:
Jason R. Coombs 2021-02-15 13:10:35 -05:00
commit 0de90fda3f

View File

@ -275,14 +275,15 @@ def get_alias(aliases, path_unicode, default):
def escape_path(path):
# type: (str) -> str
"""
u"""
Return path quoted to US-ASCII.
>>> path = u'/føö/bar/☃'
>>> escape_path(path)
>>> escaped = escape_path(path)
>>> str(escaped)
'/f%C3%B8%C3%B6/bar/%E2%98%83'
>>> escape_path(path).encode('ascii')
b'/f%C3%B8%C3%B6/bar/%E2%98%83'
>>> escaped.encode('ascii').decode('ascii') == escaped
True
"""
# this always returns bytes, specifically US-ASCII, valid URL characters
segments = path.split("/")