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:
@@ -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
@@ -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",
|
||||||
|
|||||||
Reference in New Issue
Block a user