1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

router/repo: code refactoring

This commit is contained in:
Unknwon
2016-08-30 02:08:38 -07:00
parent 2a13f682e0
commit 780cc2d110
13 changed files with 253 additions and 261 deletions

View File

@@ -21,10 +21,8 @@ func ServeData(ctx *context.Context, name string, reader io.Reader) error {
buf = buf[:n]
}
_, isTextFile := base.IsTextFile(buf)
if !isTextFile {
_, isImageFile := base.IsImageFile(buf)
if !isImageFile {
if !base.IsTextFile(buf) {
if !base.IsImageFile(buf) {
ctx.Resp.Header().Set("Content-Disposition", "attachment; filename=\""+path.Base(ctx.Repo.TreePath)+"\"")
ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary")
}