From cc9270262074b154fd6d3a5df7d1f354f3b4cb37 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sun, 1 Jun 2025 00:31:58 -0400 Subject: [PATCH] fix: add try..catch around topics.post in note assertion logic --- src/activitypub/notes.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/activitypub/notes.js b/src/activitypub/notes.js index 616fc3a44f..64c6dcd53f 100644 --- a/src/activitypub/notes.js +++ b/src/activitypub/notes.js @@ -196,8 +196,8 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => { const { to, cc, attachment } = mainPost._activitypub; const tags = await Notes._normalizeTags(mainPost._activitypub.tag || []); - await Promise.all([ - topics.post({ + try { + await topics.post({ tid, uid: authorId, cid: options.cid || cid, @@ -208,13 +208,16 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => { content: mainPost.content, sourceContent: mainPost.sourceContent, _activitypub: mainPost._activitypub, - }), - Notes.updateLocalRecipients(mainPid, { to, cc }), - ]); - unprocessed.shift(); + }); + unprocessed.shift(); + } catch (e) { + activitypub.helpers.log(`[activitypub/notes.assert] Could not post topic (${mainPost.pid}): ${e.message}`); + return null; + } // These must come after topic is posted await Promise.all([ + Notes.updateLocalRecipients(mainPid, { to, cc }), mainPost._activitypub.image ? topics.thumbs.associate({ id: tid, path: mainPost._activitypub.image,