diff options
author | Unknwon <u@gogs.io> | 2017-03-17 19:42:21 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-03-17 19:42:21 -0400 |
commit | b3c4a39208331fd3798923bde01bf556b9e90c0d (patch) | |
tree | de098f555a9512a283baad03114494d31307ebab /routers | |
parent | cac7af2c783e12b68e8263b57a150d19f085f4da (diff) |
setting: add config option for raw file render mode (#3608)
Added '[repository] ENABLE_RAW_FILE_RENDER_MODE'.
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/download.go | 3 |
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) |