mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix(core): Fix resolve RL values in expressions (#4173)
* update interface * update expression resolving * 🔥 remove ExtractValue functions * add flags * update resolving * update expr * fix for list mode * clean up * Fix up * update guard * fix bug with switching * update to handle expr referencing * fix legacy expression * fix when switching * update spacing Co-authored-by: Valya Bullions <valya@n8n.io>
This commit is contained in:
@@ -23,12 +23,19 @@ import {
|
||||
ITaskData,
|
||||
IWorkflowDataProxyAdditionalKeys,
|
||||
IWorkflowDataProxyData,
|
||||
INodeParameterResourceLocator,
|
||||
NodeHelpers,
|
||||
NodeParameterValueType,
|
||||
Workflow,
|
||||
WorkflowExecuteMode,
|
||||
} from '.';
|
||||
|
||||
export function isResourceLocatorValue(value: unknown): value is INodeParameterResourceLocator {
|
||||
return Boolean(
|
||||
typeof value === 'object' && value && 'mode' in value && 'value' in value && '__rl' in value,
|
||||
);
|
||||
}
|
||||
|
||||
export class WorkflowDataProxy {
|
||||
private workflow: Workflow;
|
||||
|
||||
@@ -194,6 +201,20 @@ export class WorkflowDataProxy {
|
||||
returnValue = node.parameters[name];
|
||||
}
|
||||
|
||||
if (isResourceLocatorValue(returnValue)) {
|
||||
if (returnValue.__regex && typeof returnValue.value === 'string') {
|
||||
const expr = new RegExp(returnValue.__regex);
|
||||
const extracted = expr.exec(returnValue.value);
|
||||
if (extracted && extracted.length >= 2) {
|
||||
returnValue = extracted[1];
|
||||
} else {
|
||||
return returnValue.value;
|
||||
}
|
||||
} else {
|
||||
returnValue = returnValue.value;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof returnValue === 'string' && returnValue.charAt(0) === '=') {
|
||||
// The found value is an expression so resolve it
|
||||
return that.workflow.expression.getParameterValue(
|
||||
|
||||
Reference in New Issue
Block a user