From 38e657b6f637a9655f5553608e68f9c28bafd30a Mon Sep 17 00:00:00 2001 From: Muffin Date: Sat, 19 Aug 2023 12:12:44 -0500 Subject: [PATCH] Don't try to serialize or deserialize blobs in arrays We don't have any --- src/p4/blob-serializer.js | 4 ++-- test/p4/blob-seriralizer.test.js | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/p4/blob-serializer.js b/src/p4/blob-serializer.js index 90252df3..7263ba68 100644 --- a/src/p4/blob-serializer.js +++ b/src/p4/blob-serializer.js @@ -12,7 +12,7 @@ const isObjectOrArray = (value) => value !== null && typeof value === 'object'; */ const recursivelySerializeBlobs = async (object) => { if (Array.isArray(object)) { - return Promise.all(object.map(recursivelySerializeBlobs)); + return object; } const result = {}; for (const key of Object.keys(object)) { @@ -48,7 +48,7 @@ const recursivelySerializeBlobs = async (object) => { */ const recursivelyDeserializeBlobs = (object) => { if (Array.isArray(object)) { - return object.map(recursivelyDeserializeBlobs); + return object; } const result = {}; for (const key of Object.keys(object)) { diff --git a/test/p4/blob-seriralizer.test.js b/test/p4/blob-seriralizer.test.js index 35c95163..01657069 100644 --- a/test/p4/blob-seriralizer.test.js +++ b/test/p4/blob-seriralizer.test.js @@ -10,6 +10,9 @@ test('basic cloning functionality', async () => { c: 3, d: "test" } + ], + z: [ + 'abcdef' ] }, e: true