From b437e67e5ee82d07ba79defb789f5357b73e5f1c Mon Sep 17 00:00:00 2001 From: Fabien O'Carroll Date: Thu, 12 Sep 2024 18:03:30 +0700 Subject: [PATCH] Hacks to remove empty attachment/image arrays --- src/handlers.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/handlers.ts b/src/handlers.ts index bb247a46..1b772c19 100644 --- a/src/handlers.ts +++ b/src/handlers.ts @@ -430,6 +430,15 @@ export async function inboxHandler( } } + if (typeof thing?.object !== 'string') { + if (Array.isArray(thing?.object?.attachment) && thing?.object?.attachment?.length === 0) { + delete thing.object.attachment; + } + if (Array.isArray(thing?.object?.image) && thing?.object?.image?.length === 0) { + delete thing.object.attachment; + } + } + items.push(thing); } catch (err) { console.log(err);