diff --git a/app/config/collections/common.php b/app/config/collections/common.php index 704415aabb..add08931d1 100644 --- a/app/config/collections/common.php +++ b/app/config/collections/common.php @@ -1528,7 +1528,7 @@ return [ 'array' => false, ], [ - '$id' => ID::custom('imageTransformations'), + '$id' => ID::custom('transformations'), 'type' => Database::VAR_BOOLEAN, 'signed' => true, 'size' => 0, diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index 17954b67c5..2c42142443 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -314,7 +314,7 @@ App::put('/v1/storage/buckets/:bucketId') $encryption ??= $bucket->getAttribute('encryption', true); $antivirus ??= $bucket->getAttribute('antivirus', true); $compression ??= $bucket->getAttribute('compression', Compression::NONE); - $transformations ??= $bucket->getAttribute('imageTransformations', true); + $transformations ??= $bucket->getAttribute('transformations', true); // Map aggregate permissions into the multiple permissions they represent. $permissions = Permission::aggregate($permissions); @@ -326,7 +326,7 @@ App::put('/v1/storage/buckets/:bucketId') ->setAttribute('allowedFileExtensions', $allowedFileExtensions) ->setAttribute('fileSecurity', $fileSecurity) ->setAttribute('enabled', $enabled) - ->setAttribute('imageTransformations', $transformations) + ->setAttribute('transformations', $transformations) ->setAttribute('encryption', $encryption) ->setAttribute('compression', $compression) ->setAttribute('antivirus', $antivirus)); @@ -990,7 +990,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview') } // Check bucket-level transformations flag - $allowTransformations = $bucket->getAttribute('imageTransformations', true); + $allowTransformations = $bucket->getAttribute('transformations', true); if (!$allowTransformations && !$isToken && !$isPrivilegedUser) { // Transformations are disabled for this bucket throw new Exception(Exception::STORAGE_TRANSFORMATIONS_DISABLED); @@ -1124,7 +1124,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview') // Update transformedAt only when image transformations are allowed // Do not count Console/privileged requests — we only want to record // transformedAt for actual API uses. - $allowTransformations = $bucket->getAttribute('imageTransformations', true); + $allowTransformations = $bucket->getAttribute('transformations', true); $isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles()); if ($allowTransformations && !$isPrivilegedUser) { $transformedAt = $file->getAttribute('transformedAt', ''); @@ -2034,7 +2034,7 @@ App::get('/v1/storage/:bucketId/usage') 'filesStorageTotal' => $usage[$metrics[1]]['total'], 'files' => $usage[$metrics[0]]['data'], 'storage' => $usage[$metrics[1]]['data'], - 'transformations' => $usage[$metrics[2]]['data'], - 'transformationsTotal' => $usage[$metrics[2]]['total'], + 'imageTransformations' => $usage[$metrics[2]]['data'], + 'imageTransformationsTotal' => $usage[$metrics[2]]['total'], ]), Response::MODEL_USAGE_BUCKETS); }); diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index f8d076645c..c6702e0ef8 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -557,7 +557,7 @@ App::init() if ($useCache) { $route = $utopia->match($request); $isImageTransformation = $route->getPath() === '/v1/storage/buckets/:bucketId/files/:fileId/preview'; - $isPlanTransformationsDisabled = isset($plan['imageTransformations']) && $plan['imageTransformations'] === -1 && !Auth::isPrivilegedUser(Authorization::getRoles()); + $isPlanTransformationsDisabled = isset($plan['transformations']) && $plan['transformations'] === -1 && !Auth::isPrivilegedUser(Authorization::getRoles()); $key = $request->cacheIdentifier(); @@ -580,7 +580,7 @@ App::init() $bucket = Authorization::skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); // Check if bucket explicitly disables transformations - $isBucketTransformationsDisabled = !$bucket->getAttribute('imageTransformations', true); + $isBucketTransformationsDisabled = !$bucket->getAttribute('transformations', true); // Combined check: disabled if either plan or bucket disables it $isTransformationsBlocked = $isPlanTransformationsDisabled || $isBucketTransformationsDisabled; @@ -622,7 +622,7 @@ App::init() throw new Exception(Exception::STORAGE_FILE_NOT_FOUND); } // Update transformedAt only when bucket and plan allow transformations - $allowTransformations = $bucket->getAttribute('imageTransformations', true); + $allowTransformations = $bucket->getAttribute('transformations', true); if ($allowTransformations) { $transformedAt = $file->getAttribute('transformedAt', ''); if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_PROJECT_ACCESS)) > $transformedAt) { diff --git a/app/http.php b/app/http.php index 77f385bdd2..43a8d7f9e1 100644 --- a/app/http.php +++ b/app/http.php @@ -272,7 +272,7 @@ $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $reg 'encryption' => true, 'antivirus' => true, 'fileSecurity' => true, - 'imageTransformations' => true, + 'transformations' => true, '$permissions' => [ Permission::create(Role::any()), Permission::read(Role::any()), @@ -326,7 +326,7 @@ $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $reg 'encryption' => false, 'antivirus' => false, 'fileSecurity' => true, - 'imageTransformations' => true, + 'transformations' => true, '$permissions' => [], 'search' => 'buckets Screenshots', ])));