Skip to content

Commit 31f7e81

Browse files
committed
Adds type requirements in JudgehostController
This fixes issues with non-integer judgehostids throwing a 500 instead of a 404.
1 parent 34f78e7 commit 31f7e81

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

webapp/src/Controller/Jury/JudgehostController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public function indexAction(Request $request): Response
230230
/**
231231
* @throws NonUniqueResultException
232232
*/
233-
#[Route(path: '/{judgehostid}', methods: ['GET'], name: 'jury_judgehost')]
233+
#[Route(path: '/{judgehostid<\d+>}', methods: ['GET'], name: 'jury_judgehost')]
234234
public function viewAction(Request $request, int $judgehostid): Response
235235
{
236236
/** @var Judgehost|null $judgehost */
@@ -302,7 +302,7 @@ public function viewAction(Request $request, int $judgehostid): Response
302302
* @throws NonUniqueResultException
303303
*/
304304
#[IsGranted('ROLE_ADMIN')]
305-
#[Route(path: '/{judgehostid}/delete', name: 'jury_judgehost_delete')]
305+
#[Route(path: '/{judgehostid<\d+>}/delete', name: 'jury_judgehost_delete')]
306306
public function deleteAction(Request $request, int $judgehostid): Response
307307
{
308308
/** @var Judgehost $judgehost */
@@ -318,7 +318,7 @@ public function deleteAction(Request $request, int $judgehostid): Response
318318
}
319319

320320
#[IsGranted('ROLE_ADMIN')]
321-
#[Route(path: '/{judgehostid}/enable', name: 'jury_judgehost_enable')]
321+
#[Route(path: '/{judgehostid<\d+>}/enable', name: 'jury_judgehost_enable')]
322322
public function enableAction(RouterInterface $router, Request $request, int $judgehostid): RedirectResponse
323323
{
324324
/** @var Judgehost $judgehost */
@@ -330,7 +330,7 @@ public function enableAction(RouterInterface $router, Request $request, int $jud
330330
}
331331

332332
#[IsGranted('ROLE_ADMIN')]
333-
#[Route(path: '/{judgehostid}/disable', name: 'jury_judgehost_disable')]
333+
#[Route(path: '/{judgehostid<\d+>}/disable', name: 'jury_judgehost_disable')]
334334
public function disableAction(RouterInterface $router, Request $request, int $judgehostid): RedirectResponse
335335
{
336336
/** @var Judgehost $judgehost */

0 commit comments

Comments
 (0)