From 13422bc8220fb1951d9bc16018a21391f5d3d3c4 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 6 Feb 2026 14:45:23 -0500 Subject: [PATCH] fix: guard against incomplete objects when building context/chain --- src/activitypub/contexts.js | 4 ++-- src/activitypub/notes.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/activitypub/contexts.js b/src/activitypub/contexts.js index 9b88104a38..8335ae7cc4 100644 --- a/src/activitypub/contexts.js +++ b/src/activitypub/contexts.js @@ -124,7 +124,7 @@ async function parseString(uid, item) { const { type, id } = await activitypub.helpers.resolveLocalId(item); const pid = type === 'post' && id ? id : item; const postData = await posts.getPostData(pid); - if (postData) { + if (postData && postData.pid) { // Already cached return postData; } @@ -157,7 +157,7 @@ async function parseItem(uid, item) { const { type, id } = await activitypub.helpers.resolveLocalId(item.id); const pid = type === 'post' && id ? id : item.id; const postData = await posts.getPostData(pid); - if (postData) { + if (postData && postData.pid) { // Already cached return postData; } diff --git a/src/activitypub/notes.js b/src/activitypub/notes.js index 12b72494b8..56c1776318 100644 --- a/src/activitypub/notes.js +++ b/src/activitypub/notes.js @@ -536,7 +536,7 @@ Notes.getParentChain = async (uid, input) => { } const postData = await posts.getPostData(id); - if (postData) { + if (postData && postData.pid) { chain.add(postData); if (postData.toPid) { await traverse(uid, postData.toPid);