diff --git a/pkg/apis/workflow/v1alpha1/item.go b/pkg/apis/workflow/v1alpha1/item.go index 142233f657ea..288cc57e633b 100644 --- a/pkg/apis/workflow/v1alpha1/item.go +++ b/pkg/apis/workflow/v1alpha1/item.go @@ -64,9 +64,7 @@ func (i *Item) String() string { } // this convenience to remove quotes from strings will cause many problems if jsonBytes[0] == '"' { - var str string - _ = json.Unmarshal(jsonBytes, &str) - return str + return string(jsonBytes[1 : len(jsonBytes)-1]) } return string(jsonBytes) } diff --git a/pkg/apis/workflow/v1alpha1/item_test.go b/pkg/apis/workflow/v1alpha1/item_test.go index c6459ffa9081..6d06a613137f 100644 --- a/pkg/apis/workflow/v1alpha1/item_test.go +++ b/pkg/apis/workflow/v1alpha1/item_test.go @@ -71,7 +71,7 @@ var testItemStringTable = []struct { origin interface{} str string }{ - {"string", "http://www/any?query=1&query2=2", "http://www/any?query=1&query2=2"}, + {"json-string", []string{`{"foo": "bar"}`}, `["{\"foo\": \"bar\"}"]`}, {"array", []int{1, 2, 3}, "[1,2,3]"}, {"number", 1.1, "1.1"}, }