소스 검색

#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 {