From c2bf94fb2370d2009a2eb907f818955132cf8611 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 20 Apr 2025 20:40:10 +0200 Subject: [PATCH] Fix: display 404 error instead of 500 when page has been removed from filesystem --- system/router.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/system/router.php b/system/router.php index ab9ea966..4f68b127 100644 --- a/system/router.php +++ b/system/router.php @@ -108,6 +108,10 @@ $dispatcher = FastRoute\cachedDispatcher(function (FastRoute\RouteCollector $r) foreach ($routes as $route) { if (!str_contains($route[2], '__redirect__') && !str_contains($route[2], '__database__')) { + if (!is_file(BASE . 'system/pages/' . $route[2])) { + continue; + } + $routesFinal[] = [$route[0], $route[1], 'system/pages/' . $route[2], $route[3] ?? 10000]; } else {