mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-13 06:36:49 -05:00
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:
@@ -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")
|
||||
|
||||
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user