summaryrefslogtreecommitdiffstats
path: root/routers/repo/download.go
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-11-06 22:06:41 -0500
committerUnknwon <joe2010xtmf@163.com>2014-11-06 22:06:41 -0500
commit23eec252748c3ac7af2ae310aeac4ee4c9061fe9 (patch)
tree9f9d8834ef94451da2fb1d43ba63d0f130d61f79 /routers/repo/download.go
parent4e7eb5be9d3e9c9ba7238769d2b5f2f471d51b67 (diff)
downloadgitea-23eec252748c3ac7af2ae310aeac4ee4c9061fe9.tar.gz
gitea-23eec252748c3ac7af2ae310aeac4ee4c9061fe9.zip
Fix #605, fix #255, fix #101
Diffstat (limited to 'routers/repo/download.go')
-rw-r--r--routers/repo/download.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/routers/repo/download.go b/routers/repo/download.go
index abb9b06292..17642a57ea 100644
--- a/routers/repo/download.go
+++ b/routers/repo/download.go
@@ -13,9 +13,7 @@ import (
)
func SingleDownload(ctx *middleware.Context) {
- treename := ctx.Params("*")
-
- blob, err := ctx.Repo.Commit.GetBlobByPath(treename)
+ blob, err := ctx.Repo.Commit.GetBlobByPath(ctx.Repo.TreeName)
if err != nil {
ctx.Handle(500, "GetBlobByPath", err)
return
@@ -23,7 +21,7 @@ func SingleDownload(ctx *middleware.Context) {
dataRc, err := blob.Data()
if err != nil {
- ctx.Handle(500, "repo.SingleDownload(Data)", err)
+ ctx.Handle(500, "Data", err)
return
}
@@ -37,7 +35,7 @@ func SingleDownload(ctx *middleware.Context) {
_, isImageFile := base.IsImageFile(buf)
ctx.Resp.Header().Set("Content-Type", contentType)
if !isTextFile && !isImageFile {
- ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+path.Base(treename))
+ ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+path.Base(ctx.Repo.TreeName))
ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary")
}
ctx.Resp.Write(buf)