Skip to content

Commit

Permalink
πŸ› protect against missing story in join route
Browse files Browse the repository at this point in the history
  • Loading branch information
haliphax committed Sep 13, 2023
1 parent edbc2e3 commit 436dac6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/back-end/routes/story/join.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ const join = (app: Application) =>
const storyId = r.params.story;
const story = await remult.repo(Story).findId(storyId);

if (!story) {
s.sendStatus(400);
return;
}

console.log(`User ${remult.user.id} joining ${storyId}`);

if (!story._votes?.find((v) => v.participant.id === remult.user?.id)) {
Expand Down

0 comments on commit 436dac6

Please sign in to comment.