mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
net/http: make ParseMultipartForm also populate Request.PostForm
Ensures that after request.ParseMultipartForm has been invoked, Request.PostForm and Request.Form are both populated with the same formValues read in, instead of only populating Request.Form. Fixes #9305 Change-Id: I3d4a11b006fc7dffaa35360014fe15b8c74d00a3 Reviewed-on: https://go-review.googlesource.com/19986 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
40bfec0022
commit
2a7c446f98
2 changed files with 69 additions and 0 deletions
|
|
@ -997,9 +997,16 @@ func (r *Request) ParseMultipartForm(maxMemory int64) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if r.PostForm == nil {
|
||||
r.PostForm = make(url.Values)
|
||||
}
|
||||
for k, v := range f.Value {
|
||||
r.Form[k] = append(r.Form[k], v...)
|
||||
// r.PostForm should also be populated. See Issue 9305.
|
||||
r.PostForm[k] = append(r.PostForm[k], v...)
|
||||
}
|
||||
|
||||
r.MultipartForm = f
|
||||
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue