Fix Issue11474 - url2pathname() handling of '/C|/' on Windows

This commit is contained in:
Senthil Kumaran 2011-04-14 12:54:35 +08:00
parent 7f9d2ead34
commit a99b761972
3 changed files with 26 additions and 2 deletions

View file

@ -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):