Skip to content
New issue

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

fix(outputTemplate): unescape string output #371

Merged
merged 1 commit into from
May 18, 2024

Conversation

reubenmiller
Copy link
Owner

When using an output template which references a body which has non-json text, the output does not print out newline literals (due to a double json encoding problem).

For example the following command builds custom output from an event's binary file.

c8y events downloadBinary --id 93268 --outputTemplate "response.body"

Before

[[files]]\npath = \"/etc/tedge/tedge.toml\"\ntype = \"tedge.toml\"\n\n[[files]]\npath = \"/etc/tedge/mosquitto-conf/tedge-mosquitto.conf\"\ntype = \"tedge-mosquitto.conf\"\n\n[[files]]\npath = \"/etc/tedge/plugins/tedge-log-plugin.toml\"\ntype = \"tedge-log-plugin\"\nuser = \"tedge\"\ngroup = \"tedge\"\nmode = 0o0644\n

After

[[files]]
path = "/etc/tedge/tedge.toml"
type = "tedge.toml"

[[files]]
path = "/etc/tedge/mosquitto-conf/tedge-mosquitto.conf"
type = "tedge-mosquitto.conf"

[[files]]
path = "/etc/tedge/plugins/tedge-log-plugin.toml"
type = "tedge-log-plugin"
user = "tedge"
group = "tedge"
mode = 0o0644

@reubenmiller reubenmiller merged commit f6641dc into v2 May 18, 2024
4 checks passed
@reubenmiller reubenmiller deleted the fix-output-template-binary-escaping branch May 18, 2024 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

newline characters are not printed out as newlines when binary text output is used in an OutputTemplate
1 participant