From 8a0af7b44676fc3ebd6ab15be7ec6a1d36e802f0 Mon Sep 17 00:00:00 2001 From: Christoph Simon | dotSource SE Date: Sun, 10 Mar 2024 18:35:50 +0100 Subject: [PATCH] fix(utilities): Handle escape characters in ifelse-function node's return value, resolves #1887 --- .../nodes/utilities/IfElseFunction/IfElseFunction.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/components/nodes/utilities/IfElseFunction/IfElseFunction.ts b/packages/components/nodes/utilities/IfElseFunction/IfElseFunction.ts index 1e61616c7..05c9f45b7 100644 --- a/packages/components/nodes/utilities/IfElseFunction/IfElseFunction.ts +++ b/packages/components/nodes/utilities/IfElseFunction/IfElseFunction.ts @@ -143,10 +143,11 @@ class IfElseFunction_Utilities implements INode { const vm = new NodeVM(nodeVMOptions) try { 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) - return { output: responseFalse, type: false } + return { output: typeof responseFalse === 'string' ? handleEscapeCharacters(responseFalse, false) : responseFalse, type: false } } catch (e) { throw new Error(e) }