Return 404 response if tournament id is not matching on match page

Just to avoid the page crashing if they somehow ended on URL like this
This commit is contained in:
Kalle
2026-05-14 14:55:50 +03:00
parent 70f2f49688
commit ea5a78208b
2 changed files with 5 additions and 0 deletions

View File

@@ -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")

View File

@@ -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 });