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

Handle false values in $env() properly

Fixes 2517
This commit is contained in:
Nick O'Leary 2020-03-27 09:05:58 +00:00
parent 9b6e798eb6
commit 1018c0e8a5
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -566,7 +566,11 @@ function prepareJSONataExpression(value,node) {
}); });
expr.assign('env', function(name) { expr.assign('env', function(name) {
var val = getSetting(node, name); var val = getSetting(node, name);
return (val ? val : ""); if (typeof val !== 'undefined') {
return val;
} else {
return ""
}
}) })
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);