# HG changeset patch # User Mads Kiilerich # Date 1606005143 -3600 # Node ID 3ea3d3a2b3e32a994307b24ebfe04ead1d40e044 # Parent 2a2a50e100260b3263a0878ba343e2244e3bfb59 git: make sure _check_url only accept the protocols accepted by is_valid_repo_uri Avoid unnecessary flexibility, ambiguity, and complexity. The file protocol was never used. But when cloning existing managed repos, is_valid_repo_url would be skipped and _check_url would be called with absolute paths. diff -r 2a2a50e10026 -r 3ea3d3a2b3e3 kallithea/lib/vcs/backends/git/repository.py --- a/kallithea/lib/vcs/backends/git/repository.py Thu Nov 19 21:15:34 2020 +0100 +++ b/kallithea/lib/vcs/backends/git/repository.py Sun Nov 22 01:32:23 2020 +0100 @@ -159,14 +159,14 @@ when the return code is non 200 """ # check first if it's not an local url - if os.path.isdir(url) or url.startswith('file:'): + if os.path.isabs(url) and os.path.isdir(url): return True if url.startswith('git://'): return True - if '+' in url[:url.find('://')]: - url = url[url.find('+') + 1:] + if not url.startswith('http://') and not url.startswith('https://'): + raise urllib.error.URLError("Unsupported protocol in URL %s" % url) url_obj = mercurial.util.url(safe_bytes(url)) test_uri, handlers = get_urllib_request_handlers(url_obj)