mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-02 14:18:46 +02:00
Merge pull request #250 from sminnee/form-head-request-throws-500
Return 404 rather than 500 on bad actions in requesthandler
This commit is contained in:
commit
0ad6fe7ec1
@ -162,12 +162,15 @@ class RequestHandler extends ViewableData {
|
||||
}
|
||||
|
||||
try {
|
||||
if(!$this->hasMethod($action)) {
|
||||
return $this->httpError(404, "Action '$action' isn't available on class " . get_class($this) . ".");
|
||||
}
|
||||
$result = $this->$action($request);
|
||||
} catch(SS_HTTPResponse_Exception $responseException) {
|
||||
$result = $responseException->getResponse();
|
||||
}
|
||||
} else {
|
||||
return $this->httpError(403, "Action '$action' isn't allowed on class $this->class");
|
||||
return $this->httpError(403, "Action '$action' isn't allowed on class " . get_class($this) . ".");
|
||||
}
|
||||
|
||||
if($result instanceof SS_HTTPResponse && $result->isError()) {
|
||||
|
@ -189,7 +189,6 @@ class Form extends RequestHandler {
|
||||
|
||||
static $url_handlers = array(
|
||||
'field/$FieldName!' => 'handleField',
|
||||
'$Action!' => 'handleAction',
|
||||
'POST ' => 'httpSubmission',
|
||||
'GET ' => 'httpSubmission',
|
||||
'HEAD ' => 'httpSubmission',
|
||||
|
Loading…
Reference in New Issue
Block a user