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

OneClickApps: Using " in variable values breaks deployment #104

Open
jfowl opened this issue Aug 15, 2022 · 0 comments
Open

OneClickApps: Using " in variable values breaks deployment #104

jfowl opened this issue Aug 15, 2022 · 0 comments

Comments

@jfowl
Copy link

jfowl commented Aug 15, 2022

Upon trying to write a OneClickApp for https://conduit.rs I ran into the following error:

image

The variable

 - id: '$$cap_conduit_trusted_servers'
   label: Trusted servers
   defaultValue: '["matrix.org"]'
   description: "List of servers trusted to send other server's public keys."

gets rendered into

{
    "id": "["matrix.org"]",
   "label": "Trusted servers",
   "defaultValue": "[\"matrix.org\"]",
   "description": "List of servers trusted to send other server's public keys."
},

by

startDeployProcess(
template: IOneClickTemplate,
values: IHashMapGeneric<string>
) {
const self = this
let stringified = JSON.stringify(template)
for (
let index = 0;
index < template.caproverOneClickApp.variables.length;
index++
) {
const element = template.caproverOneClickApp.variables[index]
stringified = replaceWith(
element.id,
values[element.id] || '',
stringified
)
}
try {
this.template = JSON.parse(stringified)
} catch (error) {
this.onDeploymentStateChanged({
steps: ['Parsing the template'],
error: `Cannot parse: ${stringified}\n\n\n\n${error}`,
currentStep: 0,
})
return
}

Suggested fix: Maybe JSON-Escape the values before replacing text with them?

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

No branches or pull requests

1 participant