From 058f3f360e77222b8e3c124bf0f421479ac2b357 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 b8f2142..ef07e61 100644 --- a/struct_utils/named_values_to_struct.go +++ b/struct_utils/named_values_to_struct.go @@ -141,6 +141,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