diff --git a/app/features/tournament-match/TournamentMatchRepository.server.ts b/app/features/tournament-match/TournamentMatchRepository.server.ts index 757eebb18..8666f518e 100644 --- a/app/features/tournament-match/TournamentMatchRepository.server.ts +++ b/app/features/tournament-match/TournamentMatchRepository.server.ts @@ -39,6 +39,7 @@ export async function findMatchById(id: number) { "Tournament.mapPickingStyle", "TournamentRound.id as roundId", "TournamentRound.maps as roundMaps", + "Tournament.id as tournamentId", jsonArrayFrom( eb .selectFrom("TournamentTeamMember") diff --git a/app/features/tournament-match/loaders/to.$id.matches.$mid.server.ts b/app/features/tournament-match/loaders/to.$id.matches.$mid.server.ts index d568e10bc..8601f1d24 100644 --- a/app/features/tournament-match/loaders/to.$id.matches.$mid.server.ts +++ b/app/features/tournament-match/loaders/to.$id.matches.$mid.server.ts @@ -43,6 +43,10 @@ export const loader = async ({ params }: LoaderFunctionArgs) => { await TournamentMatchRepository.findMatchById(matchId), ); + if (match.tournamentId !== tournamentId) { + throw new Response(null, { status: 404 }); + } + const isBye = !match.opponentOne || !match.opponentTwo; if (isBye) { throw new Response(null, { status: 404 });