mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 03:42:16 +00:00
fix: Don't throw errors for NaN in number operators in the filter component (#9506)
This commit is contained in:
@@ -77,6 +77,10 @@ export class Expression {
|
||||
throw new ApplicationError('invalid DateTime');
|
||||
}
|
||||
|
||||
if (value === null) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
let typeName = value.constructor.name ?? 'Object';
|
||||
if (DateTime.isDateTime(value)) {
|
||||
typeName = 'DateTime';
|
||||
|
||||
@@ -40,6 +40,10 @@ function parseSingleFilterValue(
|
||||
return { valid: true, newValue: Boolean(value) };
|
||||
}
|
||||
|
||||
if (type === 'number' && Number.isNaN(value)) {
|
||||
return { valid: true, newValue: value };
|
||||
}
|
||||
|
||||
return validateFieldType('filter', value, type, { strict, parseStrings: true });
|
||||
}
|
||||
|
||||
@@ -149,7 +153,7 @@ export function executeFilterCondition(
|
||||
|
||||
let { left: leftValue, right: rightValue } = parsedValues.result;
|
||||
|
||||
const exists = leftValue !== undefined && leftValue !== null;
|
||||
const exists = leftValue !== undefined && leftValue !== null && !Number.isNaN(leftValue);
|
||||
if (condition.operator.operation === 'exists') {
|
||||
return exists;
|
||||
} else if (condition.operator.operation === 'notExists') {
|
||||
|
||||
Reference in New Issue
Block a user