diff options
author | Unknwon <u@gogs.io> | 2016-08-30 02:08:38 -0700 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-08-30 02:08:38 -0700 |
commit | 780cc2d11093e048e41f2d6da9d76f6c6ac4a5e2 (patch) | |
tree | 1657d9fecdcf70d4e0067724344f531d608efb71 /routers/repo/download.go | |
parent | 2a13f682e0fa039a610e7817495d87685f9632f2 (diff) | |
download | gitea-780cc2d11093e048e41f2d6da9d76f6c6ac4a5e2.tar.gz gitea-780cc2d11093e048e41f2d6da9d76f6c6ac4a5e2.zip |
router/repo: code refactoring
Diffstat (limited to 'routers/repo/download.go')
-rw-r--r-- | routers/repo/download.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/routers/repo/download.go b/routers/repo/download.go index 85aa76472b..faa30ac9d7 100644 --- a/routers/repo/download.go +++ b/routers/repo/download.go @@ -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") } |