Host.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:got 作者: mrozekma 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号