From 7f4d5f692dc9ac8d1458d809690f0ea7bb260e40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Thu, 26 Mar 2026 15:44:50 +0100 Subject: [PATCH] Fix non-expiry key actions --- .../Platform/Modules/Project/Http/Project/Keys/Create.php | 2 +- .../Platform/Modules/Project/Http/Project/Keys/Update.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Create.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Create.php index 447d2ae8b2..0ab914af90 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Create.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Create.php @@ -102,7 +102,7 @@ class Create extends Base throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'New API key must have expiry set, because currently authenticated API key has an expiry.'); } - if (!\is_null($expire) && $expire > $apiKey->getExpire()) { + if (!\is_null($expire) && !\is_null($apiKey->getExpire()) && $expire > $apiKey->getExpire()) { throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'New API key expiry must be sooner than currently authenticated API key expiry.'); } } diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Update.php index d372f418af..d3ac67fc76 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Update.php @@ -104,7 +104,7 @@ class Update extends Base throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Updated API key must have expiry set, because currently authenticated API key has an expiry.'); } - if (!\is_null($expire) && $expire > $apiKey->getExpire()) { + if (!\is_null($expire) && !\is_null($apiKey->getExpire()) && $expire > $apiKey->getExpire()) { throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Updated API key expiry must be sooner than currently authenticated API key expiry.'); } }