aboutsummaryrefslogtreecommitdiff
path: root/routers/repo/download.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-03-13 04:32:20 -0400
committerUnknwon <u@gogs.io>2017-03-13 04:32:20 -0400
commit1df54ea0cde038e2057d083078f952c072d0dc67 (patch)
treec5466e010f5ed8e236f5b021e669f9aa37ea0047 /routers/repo/download.go
parente6df2259abdeb75545f53a5ca4c247491b5c3d7f (diff)
release: able to add attchments to release (#1614)
Added new config section '[release.attachment]’.
Diffstat (limited to 'routers/repo/download.go')
-rw-r--r--routers/repo/download.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/routers/repo/download.go b/routers/repo/download.go
index faa30ac9..83d67a88 100644
--- a/routers/repo/download.go
+++ b/routers/repo/download.go
@@ -23,7 +23,7 @@ func ServeData(ctx *context.Context, name string, reader io.Reader) error {
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-Disposition", "attachment; filename=\""+name+"\"")
ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary")
}
} else if !ctx.QueryBool("render") {
@@ -40,7 +40,7 @@ func ServeBlob(ctx *context.Context, blob *git.Blob) error {
return err
}
- return ServeData(ctx, ctx.Repo.TreePath, dataRc)
+ return ServeData(ctx, path.Base(ctx.Repo.TreePath), dataRc)
}
func SingleDownload(ctx *context.Context) {