From f945ab79ec68fd73da6711baf83ac0a2e204e187 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 26 Aug 2022 14:52:25 +1200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Damodar Lohani --- app/controllers/api/storage.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index cdd1739b7d..5837e9344d 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -69,7 +69,7 @@ App::post('/v1/storage/buckets') ->inject('response') ->inject('dbForProject') ->inject('events') - ->action(function (string $bucketId, string $name, ?array $permissions, string $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, bool $encryption, bool $antivirus, Response $response, Database $dbForProject, Event $events) { $bucketId = $bucketId === 'unique()' ? ID::unique() : $bucketId; @@ -238,7 +238,7 @@ App::put('/v1/storage/buckets/:bucketId') ->inject('response') ->inject('dbForProject') ->inject('events') - ->action(function (string $bucketId, string $name, ?array $permissions, string $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, bool $encryption, bool $antivirus, Response $response, Database $dbForProject, Event $events) { $bucket = $dbForProject->getDocument('buckets', $bucketId); if ($bucket->isEmpty()) { @@ -741,7 +741,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId') $fileSecurity = $bucket->getAttribute('fileSecurity', false); $validator = new Authorization(Database::PERMISSION_READ); $valid = $validator->isValid($bucket->getRead()); - if (!$valid && !$fileSecurity) { + if (!$fileSecurity && !$valid) { throw new Exception(Exception::USER_UNAUTHORIZED); }