Fixed the middleware to correctly return a 404 error if the project is
not found.
This commit is contained in:
parent
953d7c4ecd
commit
cf9360a1a8
@ -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)) {
|
||||||
|
try {
|
||||||
$request->project = IDF_Project::getOr404($match[1]);
|
$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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user