From 1df54ea0cde038e2057d083078f952c072d0dc67 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Mon, 13 Mar 2017 04:32:20 -0400 Subject: release: able to add attchments to release (#1614) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added new config section '[release.attachment]’. --- routers/repo/download.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'routers/repo/download.go') 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) { -- cgit v1.2.3