diff --git a/app/config/collections.php b/app/config/collections.php index 30d9b79fbb..1916ac671c 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -998,7 +998,7 @@ $collections = [ '$id' => 'prefs', 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 16384, + 'size' => 65535, 'signed' => true, 'required' => false, 'default' => null, diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 291ddc0a05..7756041528 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -1480,10 +1480,6 @@ App::patch('/v1/account/prefs') /** @var Appwrite\Event\Event $audits */ /** @var Appwrite\Stats\Stats $usage */ - if(\strlen($prefs) > 16384) { - throw new Exception('Maximum allowed prefs size exceeded.', 400); - } - $user = $dbForInternal->updateDocument('users', $user->getId(), $user->setAttribute('prefs', $prefs)); $audits diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index baa4e2bd7e..5cef36f6ca 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -578,10 +578,6 @@ App::patch('/v1/users/:userId/prefs') /** @var Utopia\Database\Database $dbForInternal */ /** @var Appwrite\Stats\Stats $usage */ - if(\strlen($prefs) > 16384) { - throw new Exception('Maximum allowed prefs size exceeded.', 400); - } - $user = $dbForInternal->getDocument('users', $userId); if ($user->isEmpty() || $user->getAttribute('deleted')) { diff --git a/docs/references/account/update-prefs.md b/docs/references/account/update-prefs.md index 3f8c12da55..53f58cb5be 100644 --- a/docs/references/account/update-prefs.md +++ b/docs/references/account/update-prefs.md @@ -1 +1 @@ -Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 16384 characters and throws error if exceeded. \ No newline at end of file +Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. \ No newline at end of file diff --git a/docs/references/users/update-user-prefs.md b/docs/references/users/update-user-prefs.md index b0ea7a864d..11b63efa47 100644 --- a/docs/references/users/update-user-prefs.md +++ b/docs/references/users/update-user-prefs.md @@ -1 +1 @@ -Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 16384 characters and throws error if exceeded. \ No newline at end of file +Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. \ No newline at end of file diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index bca0ecfe05..eb7f14d29e 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -756,12 +756,12 @@ trait AccountBase */ $prefsObject = []; - // Add 1000 keys - for($i = 1000; $i < 2000; $i++) { - $prefsObject["key" + $i] = "HelloWorld"; - // Each key is 7 characters and value is 10 characters + // Add 1024 keys + for($i = 1000; $i < 2024; $i++) { + $prefsObject["key" + $i] = "HelloWorldHelloWorldHelloWorldHelloWorldHelloWorldHelloWorldHel"; + // Each key is 7 characters and value is 63 characters } - // That makes total size minimum of 17 000, plus any JSON stuff. Max supported is 16384, so this should exceed. + // That makes total size minimum of 70kB, plus any JSON stuff. Max supported is 64kB, so this should exceed. $response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([ 'origin' => 'http://localhost',