Skip to content

Commit

Permalink
fix: Revert "fix(controller): keep special characters in json string …
Browse files Browse the repository at this point in the history
…when … … 19da392 …use withItems (#4814)" (#5076)

Signed-off-by: Alex Collins <alex_collins@intuit.com>
  • Loading branch information
alexec committed Feb 11, 2021
1 parent 893e9c9 commit 1a0889c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions pkg/apis/workflow/v1alpha1/item.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/workflow/v1alpha1/item_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
}
Expand Down

0 comments on commit 1a0889c

Please sign in to comment.