def getCloneURL(self, name):
if self.clone_url is not None:
return self.getCloneURLFromPattern(name)
# Nothing stops 'name' from escaping the path specified by self.url, like '../../../foo'. I can't see a problem with allowing it other than that it's weird, and allowing normal subdirectory traversal could be useful, so not currently putting any restrictions on 'name'
rtn = f"{self.url}/{name}"
try:
oldEnv = dict(os.environ)
os.environ.update(makeGitEnvironment(self))
try:
git.Git().ls_remote(rtn)
finally:
os.environ.clear()
os.environ.update(oldEnv)
except git.GitCommandError as e:
err = e.stderr
# Try to strip off the formatting GitCommandError puts on stderr
match = re.search("stderr: '(.*)'$", err)
if match:
err = match.group(1)
raise RuntimeError(err)
return rtn
# Patch stashy's AuthenticationException to print the server's message (mostly for issue #16, detecting a captcha check)
评论列表
文章目录