Mercurial > kallithea
changeset 8502:3ea3d3a2b3e3 stable
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.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Sun, 22 Nov 2020 01:32:23 +0100 |
parents | 2a2a50e10026 |
children | a8a51a3bdb61 |
files | kallithea/lib/vcs/backends/git/repository.py |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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)