Archive requests with an unexpected file extension without an accept: text/html header trigger 500
Summary
During gitlab-com/gl-infra/production#8732 (closed), we threw ~1K 500
errors and paged the EOC. They were mostly (all?) for the archive endpoint and the vast majority for a .yaml
or .yml
file extension. Looking at these requests, it seems like they work fine if the file extension is what we expect (e.g., .zip
), but if you provide an unexpected file extension and no Accept
header, then it triggers a 500
.
Reproduction
OK
# 200
curl -v https://gitlab.com/gitlab-org/cli/-/archive/main/foo.zip
# 404
curl -v https://gitlab.com/gitlab-org/cli/-/archive/main/foo.yml -H 'Accept: text/html'
Failed
# 500
curl -v https://gitlab.com/gitlab-org/cli/-/archive/main/foo.yml
Impact
When requests are triggered with an unexpected file extension and no Accept
header, our backend returns a 500
and enough of these errors trigger unnecessary pages for the EOC (e.g., as it happened in gitlab-com/gl-infra/production#8732 (closed)).
Recommendation
We shouldn't be throwing 500
s when an unexpected file extension is requested and no Accept
header.
Verification
Ensure that requests for the archive endpoint that have unexpected file extensions do not trigger a 500
error irrespective of the presence of the Accept
header.