1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Improve jsonata legacy mode detection regex

Fixes #3290
This commit is contained in:
Nick O'Leary 2022-01-12 21:56:38 +00:00
parent 6d2793cac6
commit 0cf9b5f3df
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 2 additions and 2 deletions

View File

@ -247,7 +247,7 @@
var currentExpression = expressionEditor.getValue(); var currentExpression = expressionEditor.getValue();
var expr; var expr;
var usesContext = false; var usesContext = false;
var legacyMode = /(^|[^a-zA-Z0-9_'"])msg([^a-zA-Z0-9_'"]|$)/.test(currentExpression); var legacyMode = /(^|[^a-zA-Z0-9_'".])msg([^a-zA-Z0-9_'"]|$)/.test(currentExpression);
$(".red-ui-editor-type-expression-legacy").toggle(legacyMode); $(".red-ui-editor-type-expression-legacy").toggle(legacyMode);
try { try {
expr = jsonata(currentExpression); expr = jsonata(currentExpression);

View File

@ -686,7 +686,7 @@ function prepareJSONataExpression(value,node) {
return moment(arg1, arg2, arg3, arg4); return moment(arg1, arg2, arg3, arg4);
}); });
expr.registerFunction('clone', cloneMessage, '<(oa)-:o>'); expr.registerFunction('clone', cloneMessage, '<(oa)-:o>');
expr._legacyMode = /(^|[^a-zA-Z0-9_'"])msg([^a-zA-Z0-9_'"]|$)/.test(value); expr._legacyMode = /(^|[^a-zA-Z0-9_'".])msg([^a-zA-Z0-9_'"]|$)/.test(value);
expr._node = node; expr._node = node;
return expr; return expr;
} }