mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #1741 from kinglozzer/1696_handlerequest_fix
Fix: RequestHandler not managing 404/403 errors correctly (fixes #1696)
This commit is contained in:
commit
5fbf2e9303
@ -180,15 +180,13 @@ class RequestHandler extends ViewableData {
|
|||||||
|
|
||||||
$className = get_class($this);
|
$className = get_class($this);
|
||||||
|
|
||||||
if(!$this->hasAction($action)) {
|
|
||||||
return new SS_HTTPResponse("Action '$action' isn't available on class $className.", 404);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$this->checkAccessAction($action) || in_array(strtolower($action), array('run', 'init'))) {
|
|
||||||
return new SS_HTTPResponse("Action '$action' isn't allowed on class $className.", 403);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if(!$this->hasAction($action)) {
|
||||||
|
return $this->httpError(404, "Action '$action' isn't available on class $className.");
|
||||||
|
}
|
||||||
|
if(!$this->checkAccessAction($action) || in_array(strtolower($action), array('run', 'init'))) {
|
||||||
|
return $this->httpError(403, "Action '$action' isn't allowed on class $className.");
|
||||||
|
}
|
||||||
$result = $this->handleAction($request, $action);
|
$result = $this->handleAction($request, $action);
|
||||||
}
|
}
|
||||||
catch (SS_HTTPResponse_Exception $e) {
|
catch (SS_HTTPResponse_Exception $e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user