mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-29 15:13:53 +03:00
Add Content-Disposition header for downloads (#3439)
This commit is contained in:
parent
25b23c4bc9
commit
fa12c282f6
1 changed files with 1 additions and 0 deletions
|
@ -325,6 +325,7 @@ func runWeb(ctx *cli.Context) error {
|
||||||
defer fr.Close()
|
defer fr.Close()
|
||||||
|
|
||||||
ctx.Header().Set("Cache-Control", "public,max-age=86400")
|
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.
|
// Fix #312. Attachments with , in their name are not handled correctly by Google Chrome.
|
||||||
// We must put the name in " manually.
|
// 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 {
|
||||||
|
|
Loading…
Reference in a new issue