From 735425e902a77cb8e08ae101eabc1aba51c7b5ed Mon Sep 17 00:00:00 2001 From: YISH Date: Mon, 26 Feb 2024 11:05:29 +0800 Subject: [PATCH] Update CustomFunction.ts --- .../utilities/CustomFunction/CustomFunction.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/components/nodes/utilities/CustomFunction/CustomFunction.ts b/packages/components/nodes/utilities/CustomFunction/CustomFunction.ts index 2ec6074a..9c1469e0 100644 --- a/packages/components/nodes/utilities/CustomFunction/CustomFunction.ts +++ b/packages/components/nodes/utilities/CustomFunction/CustomFunction.ts @@ -90,15 +90,18 @@ class CustomFunction_Utilities implements INode { // Some values might be a stringified JSON, parse it for (const key in inputVars) { - value = handleEscapeCharacters(value, true) - if (value.startsWith('{') && value.endsWith('}')) { - try { - value = JSON.parse(value) - } catch (e) { - // ignore + let value = inputVars[key] + if (typeof value === 'string') { + value = handleEscapeCharacters(value, true) + if (value.startsWith('{') && value.endsWith('}')) { + try { + value = JSON.parse(value) + } catch (e) { + // ignore + } } + inputVars[key] = value } - inputVars[key] = value } let sandbox: any = { $input: input }