1
0
Fork 0
mirror of synced 2024-06-26 18:20:43 +12:00

small fix

This commit is contained in:
shimon 2022-06-01 14:31:03 +03:00
parent 0c435b9c3b
commit 2d7bc4fb16
2 changed files with 3 additions and 3 deletions

View file

@ -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);

View file

@ -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);
}