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

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?
Upon trying to write a OneClickApp for https://conduit.rs I ran into the following error:
The variable
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
caprover-frontend/src/containers/apps/oneclick/OneClickAppDeployManager.ts
Lines 41 to 70 in 60f9a44
Suggested fix: Maybe JSON-Escape the values before replacing text with them?