Skip to content

Node.js based forum software built for the modern web

fix: null checks for category sync and actor assertions

Julian Lamb3b8b9e98d14
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]]');
}