fix(editor): Avoid infinite loops when resolving the expression {{ $parameter }} (no-changelog) (#6855)

Co-authored-by: Oleg Ivaniv <me@olegivaniv.com>
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-08-07 11:52:33 +02:00
committed by GitHub
parent adcf5a96e8
commit 8126181e18
3 changed files with 14 additions and 5 deletions

View File

@@ -27,6 +27,7 @@ import * as NodeHelpers from './NodeHelpers';
import { ExpressionError } from './ExpressionError';
import type { Workflow } from './Workflow';
import { augmentArray, augmentObject } from './AugmentObject';
import { deepCopy } from './utils';
export function isResourceLocatorValue(value: unknown): value is INodeParameterResourceLocator {
return Boolean(
@@ -213,6 +214,8 @@ export class WorkflowDataProxy {
},
get(target, name, receiver) {
if (name === 'isProxy') return true;
if (name === 'toJSON') return () => deepCopy(target);
name = name.toString();
let returnValue: NodeParameterValueType;
@@ -231,6 +234,9 @@ export class WorkflowDataProxy {
returnValue = node.parameters[name];
}
// Avoid recursion
if (returnValue === `={{ $parameter.${name} }}`) return undefined;
if (isResourceLocatorValue(returnValue)) {
if (returnValue.__regex && typeof returnValue.value === 'string') {
const expr = new RegExp(returnValue.__regex);