From a9683ba9a7cbb20213766fba8d9096b4f8591d86 Mon Sep 17 00:00:00 2001 From: 1911860538 Date: Sun, 20 Oct 2024 13:09:04 +0800 Subject: [PATCH] net/http: enhance cloneMultipartForm by initializing Value with File length --- src/net/http/clone.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net/http/clone.go b/src/net/http/clone.go index 71f42422731..0c2daf85524 100644 --- a/src/net/http/clone.go +++ b/src/net/http/clone.go @@ -68,7 +68,7 @@ func cloneMultipartForm(f *multipart.Form) *multipart.Form { Value: (map[string][]string)(Header(f.Value).Clone()), } 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 { vv2 := make([]*multipart.FileHeader, len(vv)) for i, v := range vv {