mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-24 13:05:50 +00:00
Merge commit '2fb603e60' into 3603.scripts
This commit is contained in:
commit
0de90fda3f
@ -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("/")
|
||||
|
Loading…
x
Reference in New Issue
Block a user