1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 11:31:54 +08:00

fix #2203: omit the charset attribute when Content-Type is text/html

License: MIT
Signed-off-by: Abdeldjalil Hebal <dreamski21@gmail.com>
This commit is contained in:
Djalil Dreamski
2019-11-02 21:56:54 +01:00
committed by GitHub
parent b3aa7706b2
commit aefff48654

View File

@ -383,6 +383,12 @@ func (i *gatewayHandler) serveFile(w http.ResponseWriter, req *http.Request, nam
}
}
mime := http.DetectContentType(content)
if strings.HasPrefix(mime, "text/html;") {
mime = "text/html"
}
w.Header().Set("Content-Type", mime)
http.ServeContent(w, req, name, modtime, content)
}