From 2d7bc4fb164de1dc25ba07bbe9f2011b66c9d881 Mon Sep 17 00:00:00 2001 From: shimon Date: Wed, 1 Jun 2022 14:31:03 +0300 Subject: [PATCH] small fix --- app/controllers/api/projects.php | 4 ++-- app/controllers/general.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 60e0b2b42e..e89016a494 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -779,7 +779,7 @@ App::post('/v1/projects/:projectId/keys') ->param('expire', null, new Integer() , 'Key expiration timestamp', true) ->inject('response') ->inject('dbForConsole') - ->action(function (string $projectId, string $name, array $scopes, int $expire, Response $response, Database $dbForConsole) { + ->action(function (string $projectId, string $name, array $scopes, int|null $expire, Response $response, Database $dbForConsole) { $project = $dbForConsole->getDocument('projects', $projectId); @@ -888,7 +888,7 @@ App::put('/v1/projects/:projectId/keys/:keyId') ->param('expire', null, new Integer() , 'Key expiration timestamp', true) ->inject('response') ->inject('dbForConsole') - ->action(function (string $projectId, string $keyId, string $name, array $scopes, int $expire, Response $response, Database $dbForConsole) { + ->action(function (string $projectId, string $keyId, string $name, array $scopes, int|null $expire, Response $response, Database $dbForConsole) { $project = $dbForConsole->getDocument('projects', $projectId); diff --git a/app/controllers/general.php b/app/controllers/general.php index f29a8d67ca..690d0aca48 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -281,7 +281,7 @@ App::init(function (App $utopia, Request $request, Response $response, Document $expire = $key->getAttribute('expire', 0); - if($expire !== 0 && $expire < \time()){ + if(!empty($expire) && $expire < \time()){ throw new AppwriteException('Project key expired', 401, AppwriteException:: PROJECT_KEY_EXPIRED); }