mirror of
https://github.com/gofiber/fiber.git
synced 2025-02-23 11:03:48 +00:00
🐛 Escape fname
This commit is contained in:
parent
fc5d2d7e66
commit
f698b5d506
2
ctx.go
2
ctx.go
@ -196,7 +196,7 @@ func (ctx *Ctx) Attachment(filename ...string) {
|
|||||||
if len(filename) > 0 {
|
if len(filename) > 0 {
|
||||||
fname := filepath.Base(filename[0])
|
fname := filepath.Base(filename[0])
|
||||||
ctx.Type(filepath.Ext(fname))
|
ctx.Type(filepath.Ext(fname))
|
||||||
ctx.Set(HeaderContentDisposition, `attachment; filename="`+fname+`"`)
|
ctx.Set(HeaderContentDisposition, `attachment; filename="`+url.QueryEscape(fname)+`"`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx.Set(HeaderContentDisposition, "attachment")
|
ctx.Set(HeaderContentDisposition, "attachment")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user