##// END OF EJS Templates
url: fix file:// URL handling
Patrick Mezard -
r7284:ac81ffac default
parent child Browse files
Show More
@@ -250,7 +250,12 b' def getauthinfo(path):'
250 scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path)
250 scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path)
251 if not urlpath:
251 if not urlpath:
252 urlpath = '/'
252 urlpath = '/'
253 urlpath = quotepath(urlpath)
253 if scheme != 'file':
254 # XXX: why are we quoting the path again with some smart
255 # heuristic here? Anyway, it cannot be done with file://
256 # urls since path encoding is os/fs dependent (see
257 # urllib.pathname2url() for details).
258 urlpath = quotepath(urlpath)
254 host, port, user, passwd = netlocsplit(netloc)
259 host, port, user, passwd = netlocsplit(netloc)
255
260
256 # urllib cannot handle URLs with embedded user or passwd
261 # urllib cannot handle URLs with embedded user or passwd
@@ -296,7 +301,9 b' def opener(ui, authinfo=None):'
296 def open(ui, url, data=None):
301 def open(ui, url, data=None):
297 scheme = urlparse.urlsplit(url)[0]
302 scheme = urlparse.urlsplit(url)[0]
298 if not scheme:
303 if not scheme:
299 url, authinfo = 'file://' + util.normpath(os.path.abspath(url)), None
304 path = util.normpath(os.path.abspath(url))
305 url = 'file://' + urllib.pathname2url(path)
306 authinfo = None
300 else:
307 else:
301 url, authinfo = getauthinfo(url)
308 url, authinfo = getauthinfo(url)
302 return opener(ui, authinfo).open(url, data)
309 return opener(ui, authinfo).open(url, data)
General Comments 0
You need to be logged in to leave comments. Login now