From 4174c907f226465888cca24cdc27dc5baa0559dc Mon Sep 17 00:00:00 2001 From: hiimyusheng Date: Wed, 2 Mar 2022 12:06:34 +0800 Subject: [PATCH] fix file attachment function to make sure all browser will get the same filename --- context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/context.go b/context.go index d69df70b..798e145b 100644 --- a/context.go +++ b/context.go @@ -1018,7 +1018,7 @@ func (c *Context) FileFromFS(filepath string, fs http.FileSystem) { // FileAttachment writes the specified file into the body stream in an efficient way // On the client side, the file will typically be downloaded with the given filename func (c *Context) FileAttachment(filepath, filename string) { - c.Writer.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", filename)) + c.Writer.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=%s", filename)) http.ServeFile(c.Writer, c.Request, filepath) }