From 2e9e33e65f3d961b6158461c6146f24b901e9a7c Mon Sep 17 00:00:00 2001 From: Ioannis Igoumenos Date: Thu, 2 Jul 2026 18:01:04 +0300 Subject: [PATCH] Fix undefined $coId in PagesController deliver/show redirects to prevent 500s and ensure redirect to /{coId}/pages/error-landing --- app/config/routes.php | 2 +- app/src/Controller/PagesController.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/config/routes.php b/app/config/routes.php index 2a812a754..178461e18 100644 --- a/app/config/routes.php +++ b/app/config/routes.php @@ -198,7 +198,7 @@ function (RouteBuilder $builder) { ); /** - * Registry allows URLs of the form /coid/name to render as a Mostly Static Page. + * Registry allows URLs of the form /coid/pages/name to render as a Mostly Static Page. * * Note this will effectively route any URL of the form /registry/x, where x consists of * digits, to the Pages controller. We need to filter on digits, or we'll end up taking diff --git a/app/src/Controller/PagesController.php b/app/src/Controller/PagesController.php index 8d563c341..10d9587a1 100644 --- a/app/src/Controller/PagesController.php +++ b/app/src/Controller/PagesController.php @@ -64,6 +64,8 @@ public function deliver(string $coid, string $name) { // with PrimaryLink lookups. We render here rather than redirecting into the MSRController to // reduce URL bar thrashing. + $coId = (int)$coid; + // MSRs are only enabled if file uploads are enabled $CoSettings = TableRegistry::getTableLocator()->get("CoSettings"); @@ -176,6 +178,8 @@ public function show(string $coid, string $name) { // redefining it. We render here rather than redirecting into the MSPController to // reduce URL bar thrashing. + $coId = (int)$coid; + $MSPTable = TableRegistry::getTableLocator()->get("MostlyStaticPages"); $msp = $MSPTable->find()