mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Fix Issue11474 - url2pathname() handling of '/C|/' on Windows
This commit is contained in:
parent
7f9d2ead34
commit
a99b761972
3 changed files with 26 additions and 2 deletions
|
@ -25,11 +25,14 @@ def url2pathname(url):
|
|||
error = 'Bad URL: ' + url
|
||||
raise IOError, error
|
||||
drive = comp[0][-1].upper()
|
||||
components = comp[1].split('/')
|
||||
path = drive + ':'
|
||||
for comp in components:
|
||||
components = comp[1].split('/')
|
||||
for comp in components:
|
||||
if comp:
|
||||
path = path + '\\' + urllib.unquote(comp)
|
||||
# Issue #11474: url like '/C|/' should convert into 'C:\\'
|
||||
if path.endswith(':') and url.endswith('/'):
|
||||
path += '\\'
|
||||
return path
|
||||
|
||||
def pathname2url(p):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue