We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
example script:
- name: parse_network_tag_data steps: - script: echo '{{.tag_data}}' | jq '.[].id' | perl -pe 'chomp;s/"(.+?)"/&id=\1/g;' | sed 's/^&//'
This results in the following variables:
{ "step": { "script": "echo '[{\"createdAt\":\"2023-05-22T14:35:24.367570311+02:00\",\"id\":\"1d423a9c-2a6a-4bc9-afcf-b53f19403c9b\",\"key\":\"Test-Tag-0\",\"updatedAt\":\"2023-05-22T14:35:24.367570311+02:00\",\"value\":\"Test-Value-0\"}, {\"createdAt\":\"2023-05-22T14:35:24.367570311+02:00\",\"id\":\"e18e6f91-cd75-4bb9-8733-65eea005f11f\",\"key\":\"Test-Tag-1\",\"updatedAt\":\"2023-05-22T14:35:24.367570311+02:00\",\"value\":\"Test-Value-1\"}]' | jq '.[].id' | perl -pe 'chomp;s/\"(.+?)\"/\u0026id=\\1/g;' | sed 's/^\u0026//'" }, "result": { "systemout": "id=1d423a9c-2a6a-4bc9-afcf-b53f19403c9b\u0026id=e18e6f91-cd75-4bb9-8733-65eea005f11f", "code": "0", "timeseconds": 0.154433031 } }
The '&' character is unicode escaped by '\u0026' in the result. This is caused by the json.Marshal (https://cs.opensource.google/go/go/+/master:src/encoding/json/encode.go;l=161)
This breaks following test steps that need this '&' as the result is used in a URL query.
Suggestion: The Marshalling of variables into json could be done another way in Go to fix this escaping.
func JSONMarshal(t interface{}) ([]byte, error) { buffer := &bytes.Buffer{} encoder := json.NewEncoder(buffer) encoder.SetEscapeHTML(false) err := encoder.Encode(t) return buffer.Bytes(), err }
Let me know if you think this is a good fix? Or should I consider passing the variable another way?
The text was updated successfully, but these errors were encountered:
I'm not sure about the suggested fix, but yes, it's a bug.
Sorry, something went wrong.
No branches or pull requests
example script:
This results in the following variables:
The '&' character is unicode escaped by '\u0026' in the result. This is caused by the json.Marshal (https://cs.opensource.google/go/go/+/master:src/encoding/json/encode.go;l=161)
This breaks following test steps that need this '&' as the result is used in a URL query.
Suggestion:
The Marshalling of variables into json could be done another way in Go to fix this escaping.
Let me know if you think this is a good fix? Or should I consider passing the variable another way?
The text was updated successfully, but these errors were encountered: