mirror of https://github.com/python/cpython
As Des Barry points out, we need to call pathname2url(file) in two
calls to addinfourl() in open_file().
This commit is contained in:
parent
ba21d10d9b
commit
4505895e68
|
@ -334,13 +334,13 @@ class URLopener:
|
||||||
if not host:
|
if not host:
|
||||||
return addinfourl(
|
return addinfourl(
|
||||||
open(url2pathname(file), 'rb'),
|
open(url2pathname(file), 'rb'),
|
||||||
headers, 'file:'+file)
|
headers, 'file:'+pathname2url(file))
|
||||||
host, port = splitport(host)
|
host, port = splitport(host)
|
||||||
if not port and socket.gethostbyname(host) in (
|
if not port and socket.gethostbyname(host) in (
|
||||||
localhost(), thishost()):
|
localhost(), thishost()):
|
||||||
return addinfourl(
|
return addinfourl(
|
||||||
open(url2pathname(file), 'rb'),
|
open(url2pathname(file), 'rb'),
|
||||||
headers, 'file:'+file)
|
headers, 'file:'+pathname2url(file))
|
||||||
raise IOError, ('local file error', 'not on local host')
|
raise IOError, ('local file error', 'not on local host')
|
||||||
|
|
||||||
# Use FTP protocol
|
# Use FTP protocol
|
||||||
|
|
Loading…
Reference in New Issue