From aaacefaa4a90b81a32c1904e4e3006938e89adc3 Mon Sep 17 00:00:00 2001 From: Leonhard Stemplinger Date: Fri, 20 Sep 2024 14:35:07 +0200 Subject: [PATCH] Fix bracket handling in StringToString (#413) --- string_to_string.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/string_to_string.go b/string_to_string.go index 890a01af..26b3578a 100644 --- a/string_to_string.go +++ b/string_to_string.go @@ -77,7 +77,10 @@ func (s *stringToStringValue) String() string { } func stringToStringConv(val string) (interface{}, error) { - val = strings.Trim(val, "[]") + if strings.HasPrefix(val, "[") && strings.HasSuffix(val, "]") { + val = strings.TrimPrefix(val, "[") + val = strings.TrimSuffix(val, "]") + } // An empty string would cause an empty map if len(val) == 0 { return map[string]string{}, nil