fix: guard getInReplyTo call for partial Fedify objects

Some resolved Note objects from Create activities don't have
getInReplyTo as a function (Fedify stub/partial resolution).
Add typeof check and try-catch to prevent inbox processing crash.
This commit is contained in:
Ricardo
2026-02-20 08:22:43 +01:00
parent 84122cc470
commit 473624c709
2 changed files with 9 additions and 5 deletions
+8 -4
View File
@@ -207,10 +207,14 @@ export function registerInboxListeners(inboxChain, options) {
actorObj?.preferredUsername?.toString() || actorObj?.preferredUsername?.toString() ||
actorUrl; actorUrl;
const inReplyTo = let inReplyTo = null;
object instanceof Note if (object instanceof Note && typeof object.getInReplyTo === "function") {
? (await object.getInReplyTo())?.id?.href try {
: null; inReplyTo = (await object.getInReplyTo())?.id?.href ?? null;
} catch {
/* remote fetch may fail */
}
}
// Log replies to our posts (existing behavior for conversations) // Log replies to our posts (existing behavior for conversations)
if (inReplyTo) { if (inReplyTo) {
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@rmdes/indiekit-endpoint-activitypub", "name": "@rmdes/indiekit-endpoint-activitypub",
"version": "1.0.11", "version": "1.0.12",
"description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.", "description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.",
"keywords": [ "keywords": [
"indiekit", "indiekit",