fix(gateway): ensure directory listings have Content-Type text/html#7330
fix(gateway): ensure directory listings have Content-Type text/html#7330Stebalien merged 2 commits intoipfs:masterfrom
Conversation
|
Thank you for submitting this PR!
Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution. |
|
How exactly did you run into this problem? |
|
One of the configured |
|
Ah, I see. |
|
(i.e., inside the branch and again before rendering the template)
|
Report a consistent status code for HEAD requests that end up in a redirect.
Files already have an explicit Content-Type set. Be sure to do this for directory listings as well to avoid a fallback to autodetection in net/http. That fallback fails when a ResponseWriter is installed that performs compression.
4885c94 to
d4952f2
Compare
|
There is only one error case now, namely when the directory contents cannot be read. In that special case, the content-type will be text/plain while the HEAD request will return text/html. I'd say that is acceptable. Since the previous version, #4233 got merged which introduces a new edge case: if |
|
Thanks! |
…tent-type fix(gateway): ensure directory listings have Content-Type text/html This commit was moved from ipfs/kubo@2380343
Files already have an explicit Content-Type set. Be sure to do this for
directory listings as well to avoid a fallback to autodetection in
net/http. That fallback fails when a ResponseWriter is installed that
performs compression.