diff options
author | Andrey Nering <andrey.nering@gmail.com> | 2016-11-26 10:08:31 -0200 |
---|---|---|
committer | Andrey Nering <andrey.nering@gmail.com> | 2016-11-26 10:13:25 -0200 |
commit | 638dd24cec6f2951ecd4550165b858138c4c3f40 (patch) | |
tree | 8b71b0f1f1bbf419fcfa303af9311d18706acd30 /cmd | |
parent | 0a76d260fa16764ab66bf1623b4cd9e9adfdac27 (diff) | |
download | gitea-638dd24cec6f2951ecd4550165b858138c4c3f40.tar.gz gitea-638dd24cec6f2951ecd4550165b858138c4c3f40.zip |
Fix HTTP headers for issue attachment download
- Download filename was wrong for files other than images. Example: It was `download` instead of `file.pdf`
- PDF was downloading instead of showing on browser
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/web.go | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/cmd/web.go b/cmd/web.go index 3d0c977798..f5553cdf00 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -336,11 +336,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 { + if err = repo.ServeData(ctx, attach.Name, fr); err != nil { ctx.Handle(500, "ServeData", err) return } |