##// END OF EJS Templates
url: use a regex to hide unsupported ssh passwords (issue2754)
Matt Mackall -
r13900:a3403d5b stable
parent child Browse files
Show More
@@ -25,6 +25,9 b' def _urlunparse(scheme, netloc, path, pa'
25
25
26 def hidepassword(url):
26 def hidepassword(url):
27 '''hide user credential in a url string'''
27 '''hide user credential in a url string'''
28 if url.startswith("ssh://"):
29 # urllib doesn't know about ssh urls
30 return re.sub(r'(ssh://[^/]+):[^/]+(@.*)', r'\1:***\2', url)
28 scheme, netloc, path, params, query, fragment = urlparse.urlparse(url)
31 scheme, netloc, path, params, query, fragment = urlparse.urlparse(url)
29 netloc = re.sub('([^:]*):([^@]*)@(.*)', r'\1:***@\3', netloc)
32 netloc = re.sub('([^:]*):([^@]*)@(.*)', r'\1:***@\3', netloc)
30 return _urlunparse(scheme, netloc, path, params, query, fragment, url)
33 return _urlunparse(scheme, netloc, path, params, query, fragment, url)
General Comments 0
You need to be logged in to leave comments. Login now