From ebd63bcb0d8ced410008e0fde708a70766cdb586 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Mon, 6 Nov 2023 21:47:08 -0700 Subject: [PATCH] Bugfix on QueryPlus function --- pkg/templates/template_funcs.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/templates/template_funcs.go b/pkg/templates/template_funcs.go index edf61d8..f653d48 100644 --- a/pkg/templates/template_funcs.go +++ b/pkg/templates/template_funcs.go @@ -188,7 +188,11 @@ func UrlEncode(values ...interface{}) string { func QueryPlus(r *http.Request) func(...interface{}) template.URL { return func(upsert ...interface{}) template.URL { // Get current parameters. - var params = r.Form + // Note: COPY them from r.Form so we don't accidentally modify r.Form. + var params = map[string][]string{} + for k, v := range r.Form { + params[k] = v + } // Mix in the incoming fields. for i := 0; i < len(upsert); i += 2 {