瀏覽代碼

Add Content-Disposition header for downloads (#3439)

Andrey Nering 7 年之前
父節點
當前提交
fa12c282f6
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      cmd/web.go

+ 1 - 0
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 {