mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Make more effort to stringify sensibly when storing in redis.
This commit is contained in:
parent
2d92b44f52
commit
025e4ab6d1
@ -83,6 +83,13 @@ module.exports = function(RED) {
|
||||
var k = this.key || msg.topic;
|
||||
if (k) {
|
||||
if (this.structtype == "string") {
|
||||
if (Buffer.isBuffer(msg.payload)) {
|
||||
msg.payload = msg.payload.toString();
|
||||
} else if (typeof msg.payload === "object") {
|
||||
msg.payload = JSON.stringify(msg.payload);
|
||||
} else if (typeof msg.payload !== "string") {
|
||||
msg.payload = ""+msg.payload;
|
||||
}
|
||||
this.client.set(k,msg.payload);
|
||||
} else if (this.structtype == "hash") {
|
||||
var r = hashFieldRE.exec(msg.payload);
|
||||
|
Loading…
Reference in New Issue
Block a user