From b3b8b9e98d148ce78cf56f5dd39952c326fb57ca Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 24 Jan 2025 23:41:19 -0500 Subject: [PATCH] fix: null checks for category sync and actor assertions --- src/activitypub/actors.js | 2 +- src/api/activitypub.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/activitypub/actors.js b/src/activitypub/actors.js index 7076bf7520..2208f03de7 100644 --- a/src/activitypub/actors.js +++ b/src/activitypub/actors.js @@ -67,7 +67,7 @@ Actors.assert = async (ids, options = {}) => { }))); // Webfinger failures = assertion failure - if (!ids.every(Boolean)) { + if (!ids.length || !ids.every(Boolean)) { return false; } diff --git a/src/api/activitypub.js b/src/api/activitypub.js index 340f402028..36bb35acb5 100644 --- a/src/api/activitypub.js +++ b/src/api/activitypub.js @@ -38,7 +38,7 @@ function enabledCheck(next) { activitypubApi.follow = enabledCheck(async (caller, { type, id, actor } = {}) => { // Privilege checks should be done upstream const assertion = await activitypub.actors.assert(actor); - if (!assertion) { + if (!assertion || !assertion.length) { throw new Error('[[error:activitypub.invalid-id]]'); }