diff --git a/server/index.js b/server/index.js index 03b3e4cc..44beb38f 100644 --- a/server/index.js +++ b/server/index.js @@ -133,10 +133,11 @@ app.use('/api/comments/byepisodeid', async (req, res) => { const socialInteract = response.episode.socialInteract && response.episode.socialInteract.filter((si) => si.protocol === 'activitypub'); - if(!socialInteract && socialInteract.lenght >= 0) { + if(socialInteract === undefined || socialInteract.length === 0) { // Bad requests sounds appropriate, as the client is only expected to call this API // when it validated upfront that the episode has a property socialInteract with activitypub protocol res.status(400).send('The episode does not contain a socialInteract property') + return } const userAgent = USER_AGENT;