Stop checking for {s3://path}/index.html (#34325)

This commit is contained in:
Harmen Stoppels 2022-12-06 17:19:04 +01:00 committed by GitHub
parent 862029215c
commit dfab5b5ceb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,20 +70,6 @@ def s3_open(self, req):
url, headers, stream = _s3_open(orig_url)
return urllib.response.addinfourl(stream, headers, url)
except ClientError as err:
# if no such [KEY], but [KEY]/index.html exists,
# return that, instead.
if err.response["Error"]["Code"] == "NoSuchKey":
try:
_, headers, stream = _s3_open(url_util.join(orig_url, "index.html"))
return urllib.response.addinfourl(stream, headers, orig_url)
except ClientError as err2:
if err.response["Error"]["Code"] == "NoSuchKey":
# raise original error
raise urllib.error.URLError(err) from err
raise urllib.error.URLError(err2) from err2
raise urllib.error.URLError(err) from err