summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorGusted <williamzijl7@hotmail.com>2022-01-22 23:58:09 +0000
committerGitHub <noreply@github.com>2022-01-23 01:58:09 +0200
commitd644289fcb6054b3829d26b3bb0b7dcba310bca5 (patch)
tree690bb2c086f8f84ccbaf229911fb429bbf3bf24f /modules
parentfd9ff7cd6fb28085877e3b4a2c1cf4518b36525c (diff)
downloadgitea-d644289fcb6054b3829d26b3bb0b7dcba310bca5.tar.gz
gitea-d644289fcb6054b3829d26b3bb0b7dcba310bca5.zip
Backport: Disable content sniffing on `PlainTextBytes` (#18365)
- Backport of #18359
Diffstat (limited to 'modules')
-rw-r--r--modules/context/context.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/modules/context/context.go b/modules/context/context.go
index 5038850649..dd571b4d78 100644
--- a/modules/context/context.go
+++ b/modules/context/context.go
@@ -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)
}