summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorAndrey Nering <andrey.nering@gmail.com>2016-08-11 20:53:40 -0300
committer无闻 <u@gogs.io>2016-08-11 16:53:40 -0700
commitfa12c282f6bab352463d95aec80092bbf5ab6734 (patch)
treeb140921154ece94371a97adc76a700f78ceedfb3 /cmd
parent25b23c4bc991644c7db47b484dca3bb2d2694e62 (diff)
downloadgitea-fa12c282f6bab352463d95aec80092bbf5ab6734.tar.gz
gitea-fa12c282f6bab352463d95aec80092bbf5ab6734.zip
Add Content-Disposition header for downloads (#3439)
Diffstat (limited to 'cmd')
-rw-r--r--cmd/web.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/cmd/web.go b/cmd/web.go
index eb364cfec0..ed45bdc060 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -325,6 +325,7 @@ func runWeb(ctx *cli.Context) error {
defer fr.Close()
ctx.Header().Set("Cache-Control", "public,max-age=86400")
+ ctx.Header().Set("Content-Disposition", fmt.Sprintf(`inline; filename="%s"`, attach.Name))
// Fix #312. Attachments with , in their name are not handled correctly by Google Chrome.
// We must put the name in " manually.
if err = repo.ServeData(ctx, "\""+attach.Name+"\"", fr); err != nil {