1
0
Fork 0
mirror of synced 2024-06-02 19:04:49 +12:00

Implemented limit in a new way; second iteration

This commit is contained in:
Matej Baco 2021-12-20 16:21:01 +01:00
parent ed8427d9ee
commit e46b99b0a6
6 changed files with 8 additions and 16 deletions

View file

@ -998,7 +998,7 @@ $collections = [
'$id' => 'prefs',
'type' => Database::VAR_STRING,
'format' => '',
'size' => 16384,
'size' => 65535,
'signed' => true,
'required' => false,
'default' => null,

View file

@ -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

View file

@ -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')) {

View file

@ -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.
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.

View file

@ -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.
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.

View file

@ -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',