mirror of https://github.com/gogs/gogs.git
setting: add config option for raw file render mode (#3608)
Added '[repository] ENABLE_RAW_FILE_RENDER_MODE'.pull/4312/head
parent
cac7af2c78
commit
b3c4a39208
|
@ -93,6 +93,8 @@ ENABLE_LOCAL_PATH_MIGRATION = false
|
|||
; value depend of how many CPUs (cores) you have. If the value is set to zero
|
||||
; or under, GOGS will automatically detect the number of CPUs your system have
|
||||
COMMITS_FETCH_CONCURRENCY = 0
|
||||
; Enable render mode for raw file
|
||||
ENABLE_RAW_FILE_RENDER_MODE = false
|
||||
|
||||
[repository.editor]
|
||||
; List of file extensions that should have line wraps in the CodeMirror editor.
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -120,6 +120,7 @@ var (
|
|||
DisableHTTPGit bool `ini:"DISABLE_HTTP_GIT"`
|
||||
EnableLocalPathMigration bool
|
||||
CommitsFetchConcurrency int
|
||||
EnableRawFileRenderMode bool
|
||||
|
||||
// Repository editor settings
|
||||
Editor struct {
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue