mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Let JSON parser attempt to parse buffers if they contain strings
and add/fix test
This commit is contained in:
@@ -49,7 +49,11 @@ module.exports = function(RED) {
|
||||
}
|
||||
var value = RED.util.getMessageProperty(msg,node.property);
|
||||
if (value !== undefined) {
|
||||
if (typeof value === "string") {
|
||||
if (typeof value === "string" || Buffer.isBuffer(value)) {
|
||||
// if (Buffer.isBuffer(value) && node.action !== "obj") {
|
||||
// node.warn(RED._("json.errors.dropped")); done();
|
||||
// }
|
||||
// else
|
||||
if (node.action === "" || node.action === "obj") {
|
||||
try {
|
||||
RED.util.setMessageProperty(msg,node.property,JSON.parse(value));
|
||||
|
Reference in New Issue
Block a user