From df22dd4defe804121d7dc844ac6fb3442eb7ed45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Santos?= Date: Thu, 16 Jan 2020 17:58:44 +0000 Subject: [PATCH] specifically look for Location header in response --- dvc/remote/http.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dvc/remote/http.py b/dvc/remote/http.py index ca68cac5b..c04256a46 100644 --- a/dvc/remote/http.py +++ b/dvc/remote/http.py @@ -103,7 +103,13 @@ class RemoteHTTP(RemoteBASE): try: res = self._session.request(method, url, **kwargs) - if kwargs["allow_redirects"] and res.status_code in (301, 302): + redirect_no_location = ( + kwargs["allow_redirects"] + and res.status_code in (301, 302) + and "location" not in res.headers + ) + + if redirect_no_location: # AWS s3 doesn't like to add a location header to its redirects # from https://s3.amazonaws.com//* type URLs. # This should be treated as an error