diff options
author | Joas Schilling <coding@schilljs.com> | 2023-11-30 12:52:35 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-11-30 15:01:27 +0100 |
commit | e5e139f5a6f1512a854e44ffd3ba6df788b14d3d (patch) | |
tree | b2b39479386be74493da4b4ae4429881e736e8e5 /ocs | |
parent | ef3b1a86ebac1b116740a815d2b8ebace53b3980 (diff) | |
download | nextcloud-server-e5e139f5a6f1512a854e44ffd3ba6df788b14d3d.tar.gz nextcloud-server-e5e139f5a6f1512a854e44ffd3ba6df788b14d3d.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 | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ocs/v1.php b/ocs/v1.php index f1f19fb5ee4..55e9f426aba 100644 --- a/ocs/v1.php +++ b/ocs/v1.php @@ -41,6 +41,7 @@ if (\OCP\Util::needUpgrade() exit; } +use OCP\Security\Bruteforce\MaxDelayReached; use Symfony\Component\Routing\Exception\MethodNotAllowedException; use Symfony\Component\Routing\Exception\ResourceNotFoundException; @@ -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(); |