Skip to content

Commit

Permalink
Backport: Disable content sniffing on PlainTextBytes
Browse files Browse the repository at this point in the history
- Backport of go-gitea#18359
  • Loading branch information
Gusted committed Jan 22, 2022
1 parent fd9ff7c commit ca96da9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions modules/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ func (ctx *Context) PlainTextBytes(status int, bs []byte) {
}
ctx.Resp.WriteHeader(status)
ctx.Resp.Header().Set("Content-Type", "text/plain;charset=utf-8")
ctx.Resp.Header().Set("X-Content-Type-Options", "nosniff")
if _, err := ctx.Resp.Write(bs); err != nil {
log.Error("Write bytes failed: %v", err)
}
Expand Down

0 comments on commit ca96da9

Please sign in to comment.