Skip to content

OneClickApps: Using " in variable values breaks deployment #104

Description

@jfowl

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions