From b4f5af8461f447fe3b544e72b02b3eba56f92dea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Thu, 22 May 2025 17:25:47 +0200 Subject: [PATCH] Fix: unlimited deployment size --- .../Platform/Modules/Functions/Http/Deployments/Create.php | 2 +- src/Appwrite/Platform/Modules/Functions/Workers/Builds.php | 4 ++-- .../Platform/Modules/Sites/Http/Deployments/Create.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php index cda6dc38bf..1f3febbfef 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php @@ -182,7 +182,7 @@ public function action( } } - if (!$fileSizeValidator->isValid($fileSize)) { // Check if file size is exceeding allowed limit + if (!$fileSizeValidator->isValid($fileSize) && $functionSizeLimit !== 0) { // Check if file size is exceeding allowed limit throw new Exception(Exception::STORAGE_INVALID_FILE_SIZE); } diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 6ff2161c1a..87481e91ea 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -486,7 +486,7 @@ protected function buildDeployment( $sizeLimit = (int) $plan['deploymentSize'] * 1000 * 1000; } - if ($directorySize > $sizeLimit) { + if ($directorySize > $sizeLimit && $sizeLimit !== 0) { throw new \Exception('Repository directory size should be less than ' . number_format($sizeLimit / (1000 * 1000), 2) . ' MBs.'); } @@ -816,7 +816,7 @@ protected function buildDeployment( if (isset($plan['buildSize'])) { $buildSizeLimit = $plan['buildSize'] * 1000 * 1000; } - if ($response['size'] > $buildSizeLimit) { + if ($response['size'] > $buildSizeLimit && $buildSizeLimit !== 0) { throw new \Exception('Build size should be less than ' . number_format($buildSizeLimit / (1000 * 1000), 2) . ' MBs.'); } diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php index afa1dba7d8..13b1e0c830 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php @@ -183,7 +183,7 @@ public function action( } } - if (!$fileSizeValidator->isValid($fileSize)) { // Check if file size is exceeding allowed limit + if (!$fileSizeValidator->isValid($fileSize) && $siteSizeLimit !== 0) { // Check if file size is exceeding allowed limit throw new Exception(Exception::STORAGE_INVALID_FILE_SIZE); }