From 6ddc625459f64ae94cb8d602f5fa0f36428e5d53 Mon Sep 17 00:00:00 2001 From: nolan Date: Fri, 24 Jul 2020 12:34:46 -0700 Subject: [PATCH] Convert array buffer to regular buffers through processes --- storage/providers/Mongodb.js | 2 ++ structure/client/components/observers/MessageCache.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/storage/providers/Mongodb.js b/storage/providers/Mongodb.js index fd10f00..90769ca 100644 --- a/storage/providers/Mongodb.js +++ b/storage/providers/Mongodb.js @@ -172,6 +172,8 @@ class MongoDBProvider extends Provider { return new Promise((resolve, reject) => { + if(data.buffer) data.buffer = Buffer.from(data.buffer); + this.db.collection(collection).insertOne(data, (err, result) => { if(err) reject(err); diff --git a/structure/client/components/observers/MessageCache.js b/structure/client/components/observers/MessageCache.js index ae244b4..3c5310d 100644 --- a/structure/client/components/observers/MessageCache.js +++ b/structure/client/components/observers/MessageCache.js @@ -132,6 +132,8 @@ class MessageCache extends Observer { this.client.logger.error(`Failed to save buffer with image data: ${data}\n${err.stack || err}`); return null; }); + + console.log(buffer); if(buffer) { try {