From 9de5773f0a96614e13b6b9e9f3ed20e71285bbdc Mon Sep 17 00:00:00 2001 From: lesion Date: Wed, 10 Jan 2024 12:35:52 +0100 Subject: [PATCH] fix(AP): delete federated events --- server/federation/events.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server/federation/events.js b/server/federation/events.js index eab56a56..ab6719fb 100644 --- a/server/federation/events.js +++ b/server/federation/events.js @@ -82,7 +82,12 @@ module.exports = { const APEvent = req.body?.object // check if this event is new - const ap_id = req.body.id + const ap_id = APEvent?.id ?? APEvent + + if (!ap_id) { + return res.sendStatus(404) + } + const event = await Event.findOne({ where: { ap_id }, include: [APUser]}) if (!event) { return res.sendStatus(404)} @@ -147,7 +152,7 @@ module.exports = { return res.sendStatus(404) } - const event = await Event.findOne({ where: { ap_id: APEvent?.id ?? APEvent }, include: [APUser]}) + const event = await Event.findOne({ where: { ap_id }, include: [APUser]}) if (!event) { log.error('[FEDI] Event not found: %s', APEvent?.id ?? APEvent) return res.sendStatus(404)