Bugfix on QueryPlus function

This commit is contained in:
Noah Petherbridge 2023-11-06 21:47:08 -07:00
parent fae995e486
commit ebd63bcb0d

View File

@ -188,7 +188,11 @@ func UrlEncode(values ...interface{}) string {
func QueryPlus(r *http.Request) func(...interface{}) template.URL { func QueryPlus(r *http.Request) func(...interface{}) template.URL {
return func(upsert ...interface{}) template.URL { return func(upsert ...interface{}) template.URL {
// Get current parameters. // 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. // Mix in the incoming fields.
for i := 0; i < len(upsert); i += 2 { for i := 0; i < len(upsert); i += 2 {