fix: return 404 page for invalid travelinfo urls
This commit is contained in:
@@ -33,6 +33,7 @@ class TravelinfoController extends ActionController
|
|||||||
{
|
{
|
||||||
/** @var Date $date */
|
/** @var Date $date */
|
||||||
$date = $this->dateRepository->findOneByBusProId($busProId);
|
$date = $this->dateRepository->findOneByBusProId($busProId);
|
||||||
|
|
||||||
$travelinfo = $this->travelInfoRepository->findOneByProduct($date->getProduct());
|
$travelinfo = $this->travelInfoRepository->findOneByProduct($date->getProduct());
|
||||||
|
|
||||||
if (null === $travelinfo) {
|
if (null === $travelinfo) {
|
||||||
@@ -60,6 +61,15 @@ class TravelinfoController extends ActionController
|
|||||||
|
|
||||||
/** @var Date $date */
|
/** @var Date $date */
|
||||||
$date = $this->dateRepository->findForProductAndDate($product, $travelDate)->getFirst();
|
$date = $this->dateRepository->findForProductAndDate($product, $travelDate)->getFirst();
|
||||||
|
|
||||||
|
if (null === $date) {
|
||||||
|
$response = GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
|
||||||
|
$GLOBALS['TYPO3_REQUEST'],
|
||||||
|
'Reiseinformationen nicht gefunden'
|
||||||
|
);
|
||||||
|
throw new ImmediateResponseException($response, 1731071856);
|
||||||
|
}
|
||||||
|
|
||||||
$hasCourses = 0 < count($date->getServicesGeneral('KUR'));
|
$hasCourses = 0 < count($date->getServicesGeneral('KUR'));
|
||||||
|
|
||||||
$this->view->assign('travelinfo', $travelinfo);
|
$this->view->assign('travelinfo', $travelinfo);
|
||||||
|
|||||||
Reference in New Issue
Block a user