Fixed the middleware to correctly return a 404 error if the project is

not found.
This commit is contained in:
Loic d'Anterroches 2008-08-02 09:48:55 +02:00
parent 953d7c4ecd
commit cf9360a1a8

View File

@ -44,7 +44,11 @@ class IDF_Middleware
{ {
$match = array(); $match = array();
if (preg_match('#^/p/(\w+)/#', $request->query, $match)) { 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 <em>%s</em> was not found on the server.'), htmlspecialchars($request->query)));
}
} }
return false; return false;
} }