From 6c04550558f259150d1bcdc8ec4d7b92b5f50200 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 30 Aug 2022 12:55:26 +0000 Subject: [PATCH] compression attribute on create bucket endpoint --- app/controllers/api/storage.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index f8b0630a7d..0e61d97588 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -64,12 +64,13 @@ App::post('/v1/storage/buckets') ->param('enabled', true, new Boolean(true), 'Is bucket enabled?', true) ->param('maximumFileSize', (int) App::getEnv('_APP_STORAGE_LIMIT', 0), new Range(1, (int) App::getEnv('_APP_STORAGE_LIMIT', 0)), 'Maximum file size allowed in bytes. Maximum allowed value is ' . Storage::human(App::getEnv('_APP_STORAGE_LIMIT', 0), 0) . '. For self-hosted setups you can change the max limit by changing the `_APP_STORAGE_LIMIT` environment variable. [Learn more about storage environment variables](docs/environment-variables#storage)', true) ->param('allowedFileExtensions', [], new ArrayList(new Text(64), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Allowed file extensions. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' extensions are allowed, each 64 characters long.', true) + ->param('compression', 'none', new WhiteList(['none', 'gzip', 'zstd']), 'Compression algorithm choosen for compression. For file size above ' . Storage::human(APP_STORAGE_READ_BUFFER, 0) . ' compression is skipped even if it\'s enabled', true) ->param('encryption', true, new Boolean(true), 'Is encryption enabled? For file size above ' . Storage::human(APP_STORAGE_READ_BUFFER, 0) . ' encryption is skipped even if it\'s enabled', true) ->param('antivirus', true, new Boolean(true), 'Is virus scanning enabled? For file size above ' . Storage::human(APP_LIMIT_ANTIVIRUS, 0) . ' AntiVirus scanning is skipped even if it\'s enabled', true) ->inject('response') ->inject('dbForProject') ->inject('events') - ->action(function (string $bucketId, string $name, ?array $permissions, bool $fileSecurity, bool $enabled, int $maximumFileSize, array $allowedFileExtensions, bool $encryption, bool $antivirus, Response $response, Database $dbForProject, Event $events) { + ->action(function (string $bucketId, string $name, ?array $permissions, bool $fileSecurity, bool $enabled, int $maximumFileSize, array $allowedFileExtensions, string $compression, bool $encryption, bool $antivirus, Response $response, Database $dbForProject, Event $events) { $bucketId = $bucketId === 'unique()' ? ID::unique() : $bucketId; @@ -118,6 +119,7 @@ App::post('/v1/storage/buckets') 'allowedFileExtensions' => $allowedFileExtensions, 'fileSecurity' => $fileSecurity, 'enabled' => $enabled, + 'compression' => $compression, 'encryption' => $encryption, 'antivirus' => $antivirus, 'search' => implode(' ', [$bucketId, $name]),