index: make download_repo_index() handle common URL mistakes

This commit is contained in:
Hans-Christoph Steiner 2021-04-02 14:36:42 +02:00
parent a71409815e
commit 5267699d81
No known key found for this signature in database
GPG key ID: 3E177817BA1B9BFA
2 changed files with 18 additions and 1 deletions

View file

@ -1072,7 +1072,12 @@ def download_repo_index(url_str, etag=None, verify_fingerprint=True, timeout=600
raise VerificationException(_("No fingerprint in URL."))
fingerprint = query['fingerprint'][0]
url = urllib.parse.SplitResult(url.scheme, url.netloc, url.path + '/index-v1.jar', '', '')
if url.path.endswith('/index-v1.jar'):
path = url.path[:-13].rstrip('/')
else:
path = url.path.rstrip('/')
url = urllib.parse.SplitResult(url.scheme, url.netloc, path + '/index-v1.jar', '', '')
download, new_etag = net.http_get(url.geturl(), etag, timeout)
if download is None: