From 9d83a3d0da3ae6c86a04cf5ca1353473705e0a30 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 24 Nov 2025 15:48:38 -0500 Subject: [PATCH] fix: null check on attachments property in assertPrivate --- src/activitypub/notes.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/activitypub/notes.js b/src/activitypub/notes.js index 9758b1a73d..21aebb4c63 100644 --- a/src/activitypub/notes.js +++ b/src/activitypub/notes.js @@ -340,8 +340,9 @@ Notes.assertPrivate = async (object) => { const payload = await activitypub.mocks.message(object); // Naive image appending (using src/posts/attachments.js is likely better, but not worth the effort) - if (payload._activitypub.hasOwnProperty('attachment')) { - const images = payload._activitypub.attachment.filter((attachment) => { + const attachments = payload._activitypub.attachment; + if (attachments && Array.isArray(attachments)) { + const images = attachments.filter((attachment) => { return attachment.mediaType.startsWith('image/'); }).map(({ url, href }) => url || href); images.forEach((url) => {