Skip to content

Commit

Permalink
fix the messy code of the non-ASCII attachment in iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
xgfone committed Dec 30, 2021
1 parent a3b846a commit 1f265c3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion context.go
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,8 @@ func (c *Context) contentDisposition(file, name, dispositionType string) error {
name = filepath.Base(file)
}

disposition := fmt.Sprintf("%s; filename=%q", dispositionType, name)
name = url.QueryEscape(name)
disposition := fmt.Sprintf("%s; filename*=utf-8''%s", dispositionType, name)
c.res.Header().Set(HeaderContentDisposition, disposition)
return c.File(file)
}
Expand Down

0 comments on commit 1f265c3

Please sign in to comment.