From 937a8e0a0ed33ad291a661b7600e68b12447550f Mon Sep 17 00:00:00 2001 From: Johan de Klerk <jdeklerk00@gmail.com> Date: Fri, 10 Dec 2021 12:44:02 +0200 Subject: [PATCH] Dont split values if it an empty string --- struct_utils/named_values_to_struct.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/struct_utils/named_values_to_struct.go b/struct_utils/named_values_to_struct.go index acea897..68d8536 100644 --- a/struct_utils/named_values_to_struct.go +++ b/struct_utils/named_values_to_struct.go @@ -140,6 +140,9 @@ func NamedValuesFromURL(params map[string]string, multiValueParams map[string][] splitValues := []string{} for _, value := range values { //split only if valid CSV between [...] + if value == "" { + continue + } if value[0] == '[' && value[len(value)-1] == ']' { csvReader := csv.NewReader(strings.NewReader(value[1 : len(value)-1])) csvValues, csvErr := csvReader.Read() //this automatically removes quotes around some/all CSV inside the [...] -- GitLab