Skip to content

Commit

Permalink
Merge pull request #266 from stevencrader/socialInteract
Browse files Browse the repository at this point in the history
Update `/api/comments/byepisodeid` to handle episode without a `socialInteract`
  • Loading branch information
daveajones authored Jun 10, 2023
2 parents 1fc04dc + ed65902 commit 1eefc5f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1eefc5f

Please sign in to comment.