From a101c06c62298a679467132bc69780f49ce2c887 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Tue, 9 Nov 2021 14:52:32 +0000 Subject: [PATCH] Update api.php --- app/controllers/shared/api.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 7221288b66..5229390f2c 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -57,7 +57,7 @@ App::init(function ($utopia, $request, $response, $project, $user, $register, $e //TODO make sure we get array here - $closestLimit = 999; + $closestLimit = null; $isPrivilegedUser = Auth::isPrivilegedUser(Authorization::$roles); $isAppUser = Auth::isAppUser(Authorization::$roles); @@ -70,7 +70,7 @@ App::init(function ($utopia, $request, $response, $project, $user, $register, $e $abuse = new Abuse($timeLimit); - if ($timeLimit->limit() && $timeLimit->remaining() < $closestLimit) { + if ($timeLimit->limit() && $timeLimit->remaining() < $closestLimit || is_null($closestLimit)) { $closestLimit = $timeLimit->remaining(); $response ->addHeader('X-RateLimit-Limit', $timeLimit->limit())