aboutsummaryrefslogtreecommitdiff
path: root/routers/repo/download.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-03-17 19:42:21 -0400
committerUnknwon <u@gogs.io>2017-03-17 19:42:21 -0400
commitb3c4a39208331fd3798923bde01bf556b9e90c0d (patch)
treede098f555a9512a283baad03114494d31307ebab /routers/repo/download.go
parentcac7af2c783e12b68e8263b57a150d19f085f4da (diff)
setting: add config option for raw file render mode (#3608)
Added '[repository] ENABLE_RAW_FILE_RENDER_MODE'.
Diffstat (limited to 'routers/repo/download.go')
-rw-r--r--routers/repo/download.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/routers/repo/download.go b/routers/repo/download.go
index 83d67a88..3c253f90 100644
--- a/routers/repo/download.go
+++ b/routers/repo/download.go
@@ -12,6 +12,7 @@ import (
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/context"
+ "github.com/gogits/gogs/modules/setting"
)
func ServeData(ctx *context.Context, name string, reader io.Reader) error {
@@ -26,7 +27,7 @@ func ServeData(ctx *context.Context, name string, reader io.Reader) error {
ctx.Resp.Header().Set("Content-Disposition", "attachment; filename=\""+name+"\"")
ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary")
}
- } else if !ctx.QueryBool("render") {
+ } else if !setting.Repository.EnableRawFileRenderMode || !ctx.QueryBool("render") {
ctx.Resp.Header().Set("Content-Type", "text/plain; charset=utf-8")
}
ctx.Resp.Write(buf)