Skip to content

Commit 7973aac

Browse files
committed
url2pathname(): unquote before converting separators
1 parent e3a81cb commit 7973aac

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Lib/nturl2path.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ def url2pathname(url):
2424
# convert this to \\host\path\on\remote\host
2525
# (notice halving of slashes at the start of the path)
2626
url = url[2:]
27-
return urllib.parse.unquote(url.replace('/', '\\'))
27+
return urllib.parse.unquote(url).replace('/', '\\')
2828
comp = url.split('|')
2929
if len(comp) != 2 or comp[0][-1] not in string.ascii_letters:
3030
error = 'Bad URL: ' + url
3131
raise OSError(error)
3232
drive = comp[0][-1].upper()
33-
tail = comp[1].replace('/', '\\')
34-
path = drive + ':' + urllib.parse.unquote(tail)
33+
tail = urllib.parse.unquote(comp[1])
34+
path = drive + ':' + tail.replace('/', '\\')
3535
return path
3636

3737
def pathname2url(p):

0 commit comments

Comments
 (0)