Skip to content

Commit

Permalink
Hacks to remove empty attachment/image arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
allouis committed Sep 12, 2024
1 parent 4b1ac16 commit b437e67
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b437e67

Please sign in to comment.