Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

BUGFIX: Return a 404, not a 500, if an invalid action is asked for on…

… a RequestHandler.
  • Loading branch information...
commit a2c185889229e34569e7cdfae39e0d4e5923119d 1 parent 067204d
Sam Minnée sminnee authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 control/RequestHandler.php
5 control/RequestHandler.php
View
@@ -162,12 +162,15 @@ function handleRequest(SS_HTTPRequest $request, DataModel $model) {
}
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()) {
Please sign in to comment.
Something went wrong with that request. Please try again.