From cf9360a1a87f8a98dc506a316055537b95ec245f Mon Sep 17 00:00:00 2001 From: Loic d'Anterroches Date: Sat, 2 Aug 2008 09:48:55 +0200 Subject: [PATCH] Fixed the middleware to correctly return a 404 error if the project is not found. --- src/IDF/Middleware.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/IDF/Middleware.php b/src/IDF/Middleware.php index 741c462..3fb7e6a 100644 --- a/src/IDF/Middleware.php +++ b/src/IDF/Middleware.php @@ -44,7 +44,11 @@ class IDF_Middleware { $match = array(); if (preg_match('#^/p/(\w+)/#', $request->query, $match)) { - $request->project = IDF_Project::getOr404($match[1]); + try { + $request->project = IDF_Project::getOr404($match[1]); + } catch (Pluf_HTTP_Error404 $e) { + return new Pluf_HTTP_Response_NotFound(sprintf(__('The page %s was not found on the server.'), htmlspecialchars($request->query))); + } } return false; }