From 528866b8b6056de287c23faefb8dfda7a19d3b69 Mon Sep 17 00:00:00 2001 From: Mustaque Ahmed Date: Tue, 14 Oct 2025 15:54:59 +0530 Subject: [PATCH] fix: review comment --- app/controllers/shared/api.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 70294d8826..f8d076645c 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -572,10 +572,10 @@ App::init() $parts = explode('/', $cacheLog->getAttribute('resourceType', '')); $type = $parts[0] ?? null; + // Initialize variables for use in response send logic + $isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles()); + $isTransformationsBlocked = false; if ($type === 'bucket') { - // Check privileged status early to avoid unnecessary DB requests - $isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles()); - $bucketId = $parts[1] ?? null; $bucket = Authorization::skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); @@ -637,7 +637,7 @@ App::init() ->addHeader('X-Appwrite-Cache', 'hit') ->setContentType($cacheLog->getAttribute('mimeType')); // Determine if user can bypass transformation blocks - $canBypassBlock = ($type === 'bucket') && ($isPrivilegedUser || $isToken); + $canBypassBlock = ($type === 'bucket') && $isPrivilegedUser; if (!$isImageTransformation || !$isTransformationsBlocked || $canBypassBlock) { $response->send($data); }