diff --git a/files/multipartfile.go b/files/multipartfile.go index d4593ad6c..24211cdc0 100644 --- a/files/multipartfile.go +++ b/files/multipartfile.go @@ -110,7 +110,12 @@ func (w *multipartWalker) nextFile() (Node, error) { // fileName returns a normalized filename from a part. func fileName(part *multipart.Part) string { - filename := part.FileName() + v := part.Header.Get("Content-Disposition") + _, params, err := mime.ParseMediaType(v) + if err != nil { + return "" + } + filename := params["filename"] if escaped, err := url.QueryUnescape(filename); err == nil { filename = escaped } // if there is a unescape error, just treat the name as unescaped