Skip to content

Node.js based forum software built for the modern web

fix: restrict feps methods to real cids

Julian Lam8b717d541084
diff --git a/src/activitypub/feps.js b/src/activitypub/feps.js
index 4cb0b8821c..e652a0c829 100644
--- a/src/activitypub/feps.js
+++ b/src/activitypub/feps.js
@@ -1,7 +1,6 @@
'use strict';
const nconf = require('nconf');
-const winston = require('winston');
const posts = require('../posts');
@@ -14,6 +13,9 @@ Feps.announce = async function announce(id, activity) {
({ id: localId } = await activitypub.helpers.resolveLocalId(id));
}
const cid = await posts.getCidByPid(localId || id);
+ if (cid === -1) {
+ return;
+ }
const followers = await activitypub.notes.getCategoryFollowers(cid);
if (!followers.length) {
@@ -44,6 +46,9 @@ Feps.announceObject = async function announceObject(id) {
({ id: localId } = await activitypub.helpers.resolveLocalId(id));
}
const cid = await posts.getCidByPid(localId || id);
+ if (cid === -1) {
+ return;
+ }
const followers = await activitypub.notes.getCategoryFollowers(cid);
if (!followers.length) {