1
0
mirror of https://github.com/golang/go synced 2024-11-24 22:47:58 -07:00

net/http: enhance cloneMultipartForm by initializing Value with File length

This commit is contained in:
1911860538 2024-10-20 13:09:04 +08:00
parent f2d118fd5f
commit a9683ba9a7

View File

@ -68,7 +68,7 @@ func cloneMultipartForm(f *multipart.Form) *multipart.Form {
Value: (map[string][]string)(Header(f.Value).Clone()), Value: (map[string][]string)(Header(f.Value).Clone()),
} }
if f.File != nil { if f.File != nil {
m := make(map[string][]*multipart.FileHeader) m := make(map[string][]*multipart.FileHeader, len(f.File))
for k, vv := range f.File { for k, vv := range f.File {
vv2 := make([]*multipart.FileHeader, len(vv)) vv2 := make([]*multipart.FileHeader, len(vv))
for i, v := range vv { for i, v := range vv {