fix(utilities): Handle escape characters in ifelse-function node's return value, resolves #1887

This commit is contained in:
Christoph Simon | dotSource SE 2024-03-10 18:35:50 +01:00
parent 88dd9cc6b4
commit 8a0af7b446
1 changed files with 3 additions and 2 deletions

View File

@ -143,10 +143,11 @@ class IfElseFunction_Utilities implements INode {
const vm = new NodeVM(nodeVMOptions) const vm = new NodeVM(nodeVMOptions)
try { try {
const responseTrue = await vm.run(`module.exports = async function() {${ifFunction}}()`, __dirname) const responseTrue = await vm.run(`module.exports = async function() {${ifFunction}}()`, __dirname)
if (responseTrue) return { output: responseTrue, type: true } if (responseTrue)
return { output: typeof responseTrue === 'string' ? handleEscapeCharacters(responseTrue, false) : responseTrue, type: true }
const responseFalse = await vm.run(`module.exports = async function() {${elseFunction}}()`, __dirname) const responseFalse = await vm.run(`module.exports = async function() {${elseFunction}}()`, __dirname)
return { output: responseFalse, type: false } return { output: typeof responseFalse === 'string' ? handleEscapeCharacters(responseFalse, false) : responseFalse, type: false }
} catch (e) { } catch (e) {
throw new Error(e) throw new Error(e)
} }