diff options
author | Andrey Nering <andrey.nering@gmail.com> | 2016-08-11 20:53:40 -0300 |
---|---|---|
committer | 无闻 <u@gogs.io> | 2016-08-11 16:53:40 -0700 |
commit | fa12c282f6bab352463d95aec80092bbf5ab6734 (patch) | |
tree | b140921154ece94371a97adc76a700f78ceedfb3 /cmd | |
parent | 25b23c4bc991644c7db47b484dca3bb2d2694e62 (diff) | |
download | gitea-fa12c282f6bab352463d95aec80092bbf5ab6734.tar.gz gitea-fa12c282f6bab352463d95aec80092bbf5ab6734.zip |
Add Content-Disposition header for downloads (#3439)
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/web.go | 1 |
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 { |