cli: allow redirects for file size checking

Related: https://pagure.io/koji/issue/3463
This commit is contained in:
Tomas Kopecek 2022-08-17 10:24:15 +02:00
parent f4bb294d4f
commit df44502792

View file

@ -569,7 +569,7 @@ def download_file(url, relpath, quiet=False, noprogress=False, size=None,
print("Downloading: %s" % relpath) print("Downloading: %s" % relpath)
if not filesize: if not filesize:
response = requests.head(url, timeout=10) response = requests.head(url, timeout=10, allow_redirects=True)
if response.status_code == 200 and response.headers.get('Content-Length'): if response.status_code == 200 and response.headers.get('Content-Length'):
filesize = int(response.headers['Content-Length']) filesize = int(response.headers['Content-Length'])