Merge pull request #3624 from node-red-hitachi/fix-buffer-parse-error

fix buffer parse error message of evaluateNodeProperty
This commit is contained in:
Nick O'Leary
2022-06-09 16:02:48 -05:00
committed by GitHub
2 changed files with 19 additions and 1 deletions

View File

@@ -641,7 +641,12 @@ function evaluateNodeProperty(value, type, node, msg, callback) {
result = Date.now();
} else if (type === 'bin') {
var data = JSON.parse(value);
result = Buffer.from(data);
if (Array.isArray(data) || (typeof(data) === "string")) {
result = Buffer.from(data);
}
else {
throw createError("INVALID_BUFFER_DATA", "Not string or array");
}
} else if (type === 'msg' && msg) {
try {
result = getMessageProperty(msg,value);