From b7d0c127a3bf571d97b2ff68c0abdb289febe18d Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 26 May 2025 21:37:21 +1200 Subject: [PATCH] Revert "Merge pull request #9878 from ArnabChatterjee20k/dat-532" This reverts commit a366feba803c7082259b8d72e28a103793194352, reversing changes made to 484988fcd7d730d6ac710b06840a5c5fe357ae3f. --- app/controllers/api/databases.php | 6 ------ app/init/constants.php | 1 - .../Services/Databases/DatabasesCustomServerTest.php | 12 ------------ 3 files changed, 19 deletions(-) diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 4860f7a967..18b0d87053 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -1352,12 +1352,6 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/string if ($encrypt && !empty($plan) && !($plan['databasesAllowEncrypt'] ?? false)) { throw new Exception(Exception::GENERAL_BAD_REQUEST, 'Encrypted string attributes are not available on your plan. Please upgrade to create encrypted string attributes.'); } - if ($encrypt && $size < APP_DATABASE_ENCRYPT_SIZE_MIN) { - throw new Exception( - Exception::GENERAL_BAD_REQUEST, - "Size too small. Encrypted strings require a minimum size of " . APP_DATABASE_ENCRYPT_SIZE_MIN . " characters." - ); - } // Ensure attribute default is within required size $validator = new Text($size, 0); if (!is_null($default) && !$validator->isValid($default)) { diff --git a/app/init/constants.php b/app/init/constants.php index ebf79086a7..99881a4381 100644 --- a/app/init/constants.php +++ b/app/init/constants.php @@ -51,7 +51,6 @@ const APP_DATABASE_TIMEOUT_MILLISECONDS_API = 15 * 1000; // 15 seconds const APP_DATABASE_TIMEOUT_MILLISECONDS_WORKER = 300 * 1000; // 5 minutes const APP_DATABASE_TIMEOUT_MILLISECONDS_TASK = 300 * 1000; // 5 minutes const APP_DATABASE_QUERY_MAX_VALUES = 500; -const APP_DATABASE_ENCRYPT_SIZE_MIN = 150; const APP_STORAGE_UPLOADS = '/storage/uploads'; const APP_STORAGE_SITES = '/storage/sites'; const APP_STORAGE_FUNCTIONS = '/storage/functions'; diff --git a/tests/e2e/Services/Databases/DatabasesCustomServerTest.php b/tests/e2e/Services/Databases/DatabasesCustomServerTest.php index e66207b215..c0d8763aa7 100644 --- a/tests/e2e/Services/Databases/DatabasesCustomServerTest.php +++ b/tests/e2e/Services/Databases/DatabasesCustomServerTest.php @@ -686,18 +686,6 @@ class DatabasesCustomServerTest extends Scope 'size' => 256, 'required' => true, ]); - // checking size test - $lastName = $this->client->call(Client::METHOD_POST, $attributesPath . '/string', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'key' => 'lastName', - 'size' => 149, - 'required' => true, - 'encrypt' => true - ]); - $this->assertEquals("Size too small. Encrypted strings require a minimum size of " . APP_DATABASE_ENCRYPT_SIZE_MIN . " characters.", $lastName['body']['message']); $lastName = $this->client->call(Client::METHOD_POST, $attributesPath . '/string', array_merge([ 'content-type' => 'application/json',