diff --git a/.gitignore b/.gitignore index 06a228f4..84ee0a16 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ s3cmd.egg-info s3cmd.spec .idea .s3cfg +.python-version diff --git a/S3/S3.py b/S3/S3.py index d4cac8f9..b93a26a6 100644 --- a/S3/S3.py +++ b/S3/S3.py @@ -1581,7 +1581,7 @@ def _http_redirection_handler(self, request, response, fn, *args, **kwargs): S3Request.region_map[redir_bucket] = redir_region info(u'Redirected to region: %s', redir_region) return fn(*args, **kwargs) - elif request.method_string == 'HEAD': + elif response['headers'].get('location'): # Head is a special case, redirection info usually are in the body # but there is no body for an HEAD request. location_url = response['headers'].get('location')