diff options
author | Joas Schilling <coding@schilljs.com> | 2023-11-30 12:52:35 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-12-07 06:34:11 +0100 |
commit | 2fd8cf4b15f511f866dabacaf788e18e59eff1fd (patch) | |
tree | 46d532ffea30f79c77577af635151602540eee4d /ocs | |
parent | 84af629fa598b340c089c023db665238aee00c38 (diff) | |
download | nextcloud-server-2fd8cf4b15f511f866dabacaf788e18e59eff1fd.tar.gz nextcloud-server-2fd8cf4b15f511f866dabacaf788e18e59eff1fd.zip |
fix(bruteforce-protection): Don't throw a 500 when MaxDelayReached is thrown
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'ocs')
-rw-r--r-- | ocs/v1.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ocs/v1.php b/ocs/v1.php index 05539899372..55e9f426aba 100644 --- a/ocs/v1.php +++ b/ocs/v1.php @@ -41,8 +41,9 @@ if (\OCP\Util::needUpgrade() exit; } -use Symfony\Component\Routing\Exception\ResourceNotFoundException; +use OCP\Security\Bruteforce\MaxDelayReached; use Symfony\Component\Routing\Exception\MethodNotAllowedException; +use Symfony\Component\Routing\Exception\ResourceNotFoundException; /* * Try the appframework routes @@ -62,6 +63,9 @@ try { } OC::$server->get(\OC\Route\Router::class)->match('/ocsapp'.\OC::$server->getRequest()->getRawPathInfo()); +} catch (MaxDelayReached $ex) { + $format = \OC::$server->getRequest()->getParam('format', 'xml'); + OC_API::respond(new \OC\OCS\Result(null, OCP\AppFramework\Http::STATUS_TOO_MANY_REQUESTS, $ex->getMessage()), $format); } catch (ResourceNotFoundException $e) { OC_API::setContentType(); |