This commit is contained in:
Khushboo Verma 2025-04-14 12:16:50 +00:00
parent 0df1396d52
commit f02707627f
2 changed files with 11 additions and 4 deletions

View file

@ -1312,7 +1312,12 @@ App::post('/v1/functions/:functionId/deployments')
throw new Exception(Exception::STORAGE_FILE_EMPTY, 'No file sent');
}
$functionFileSize = isset($plan['functionSize']) ? $plan['functionSize'] * 1000 * 1000 : (System::getEnv('_APP_FUNCTIONS_SIZE_LIMIT') ?: 30000000);
$functionFileSize = (System::getEnv('_APP_FUNCTIONS_SIZE_LIMIT') ?: 30000000);
if (isset($plan['functionSize'])) {
$functionFileSize = $plan['functionSize'] * 1000 * 1000;
}
$fileExt = new FileExt([FileExt::TYPE_GZIP]);
$fileSizeValidator = new FileSize($functionFileSize);
$upload = new Upload();

View file

@ -405,9 +405,11 @@ class Builds extends Action
$directorySize = $localDevice->getDirectorySize($tmpDirectory);
$functionsSizeLimit = empty($plan['functionSize'])
? (int) System::getEnv('_APP_FUNCTIONS_SIZE_LIMIT', 30000000)
: (int) $plan['functionSize'] * 1000 * 1000;
$functionsSizeLimit = (int) (System::getEnv('_APP_FUNCTIONS_SIZE_LIMIT') ?: 30000000);
if (!empty($plan['functionSize'])) {
$functionsSizeLimit = (int) $plan['functionSize'] * 1000 * 1000;
}
if ($directorySize > $functionsSizeLimit) {
throw new \Exception('Repository directory size should be less than ' . number_format($functionsSizeLimit / 1048576, 2) . ' MBs.');