fix: /reiseinformationen/ without a travel info answers 404 instead of 500

The page holds only the travel info plugin, whose default action required
a travel info: opened without a slug or code it failed with "Required
argument travelInfo is not set" (TYPO3 10 did the same). The argument is
optional now and its absence gives the same 404 as an unknown slug or travel
code (notFound(), shared with travelCodeAction).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
frommeandClaude Opus 5.5 committed 2026-10-22 15:47:19 +02:00
1 parent ebc9925304
commit 20225ad9e3
1 file changed
+22 -12
@@ -45,6 +45,28 @@ class TravelinfoController extends ActionController
// return 404 in case no travel info is available as last resort // return 404 in case no travel info is available as last resort
if (null === $travelInfo) { if (null === $travelInfo) {
$this->notFound();
}
$this->handleRequest($travelCode, $travelInfo);
return $this->htmlResponse();
}
public function travelInfoAction(?Travelinfo $travelInfo = null): ResponseInterface
{
// the page itself (/reiseinformationen/) without a travel info or code
if (null === $travelInfo) {
$this->notFound();
}
$travelCode = $travelInfo->getTravelCode();
$this->handleRequest($travelCode, $travelInfo);
return $this->htmlResponse();
}
private function notFound(): never
{
$response = GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction( $response = GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
$this->request, $this->request,
'Reiseinformationen nicht gefunden' 'Reiseinformationen nicht gefunden'
@@ -52,18 +74,6 @@ class TravelinfoController extends ActionController
throw new ImmediateResponseException($response, 1731071856); throw new ImmediateResponseException($response, 1731071856);
} }
$this->handleRequest($travelCode, $travelInfo);
return $this->htmlResponse();
}
public function travelInfoAction(Travelinfo $travelInfo): ResponseInterface
{
$travelCode = $travelInfo->getTravelCode();
$this->handleRequest($travelCode, $travelInfo);
return $this->htmlResponse();
}
private function handleRequest(string $travelCode, Travelinfo $travelInfo) private function handleRequest(string $travelCode, Travelinfo $travelInfo)
{ {