瀏覽代碼

#2842 add quotes to attachment file name

Unknwon 9 年之前
父節點
當前提交
dd36c431ec
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      routers/repo/download.go

+ 1 - 1
routers/repo/download.go

@@ -25,7 +25,7 @@ func ServeData(ctx *context.Context, name string, reader io.Reader) error {
 	if !isTextFile {
 		_, isImageFile := base.IsImageFile(buf)
 		if !isImageFile {
-			ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+path.Base(ctx.Repo.TreeName))
+			ctx.Resp.Header().Set("Content-Disposition", "attachment; filename=\""+path.Base(ctx.Repo.TreeName)+"\"")
 			ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary")
 		}
 	} else {