Skip to content

Commit

Permalink
fix ipfs#2203: omit the charset attribute when Content-Type is text/html
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Abdeldjalil Hebal <dreamski21@gmail.com>
  • Loading branch information
djalilhebal authored and pontiyaraja committed Dec 19, 2019
1 parent bafe1f7 commit 6019c8a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/corehttp/gateway_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 6019c8a

Please sign in to comment.