mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-09 10:18:04 +08:00
fix(gateway): ensure directory listings have Content-Type text/html
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.
This commit is contained in:
parent
7c7888c4db
commit
d4952f2a73
@ -300,6 +300,9 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request
|
||||
return
|
||||
}
|
||||
|
||||
// A HTML directory index will be presented, be sure to set the correct
|
||||
// type instead of relying on autodetection (which may fail).
|
||||
w.Header().Set("Content-Type", "text/html")
|
||||
if r.Method == http.MethodHead {
|
||||
return
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user