diff --git a/app/config/collections.php b/app/config/collections.php index ee809e982d..c0a5b476e5 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' => new \stdClass(), diff --git a/composer.lock b/composer.lock index 55c39bc517..ed081bd8c0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d32b727a743b3a8811ec64c56f308694", + "content-hash": "d0df4734e38f660ce979011d70155357", "packages": [ { "name": "adhocore/jwt", @@ -2255,11 +2255,17 @@ }, { "name": "utopia-php/framework", - "version": "dev-fix-get-args-after-init", + "version": "0.19.5", "source": { "type": "git", - "url": "https://github.com/utopia-php/framework", - "reference": "36a42dce039f043288673f0ff46284353543624d" + "url": "https://github.com/utopia-php/framework.git", + "reference": "1c28ba9a5b491cf7c90c535fefee5832c7133623" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/utopia-php/framework/zipball/1c28ba9a5b491cf7c90c535fefee5832c7133623", + "reference": "1c28ba9a5b491cf7c90c535fefee5832c7133623", + "shasum": "" }, "require": { "php": ">=8.0.0" @@ -2274,6 +2280,7 @@ "Utopia\\": "src/" } }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -2289,7 +2296,11 @@ "php", "upf" ], - "time": "2022-01-03T08:38:34+00:00" + "support": { + "issues": "https://github.com/utopia-php/framework/issues", + "source": "https://github.com/utopia-php/framework/tree/0.19.5" + }, + "time": "2022-01-04T14:40:23+00:00" }, { "name": "utopia-php/image", @@ -3069,16 +3080,16 @@ }, { "name": "appwrite/sdk-generator", - "version": "0.16.3", + "version": "0.17.0", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "6185cdfe4c4261287240639f3a7fdc05e7ae2337" + "reference": "a68e072170a81532cfb0ff914864d8f074a73a37" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/6185cdfe4c4261287240639f3a7fdc05e7ae2337", - "reference": "6185cdfe4c4261287240639f3a7fdc05e7ae2337", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/a68e072170a81532cfb0ff914864d8f074a73a37", + "reference": "a68e072170a81532cfb0ff914864d8f074a73a37", "shasum": "" }, "require": { @@ -3112,9 +3123,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/0.16.3" + "source": "https://github.com/appwrite/sdk-generator/tree/0.17.0" }, - "time": "2021-12-16T23:56:47+00:00" + "time": "2022-01-04T09:24:44+00:00" }, { "name": "composer/pcre", @@ -6628,18 +6639,9 @@ "time": "2015-12-17T08:42:14+00:00" } ], - "aliases": [ - { - "package": "utopia-php/framework", - "version": "dev-fix-get-args-after-init", - "alias": "0.19", - "alias_normalized": "0.19.0.0" - } - ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "utopia-php/framework": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/docs/references/account/update-prefs.md b/docs/references/account/update-prefs.md index cdfbdf9f04..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. You can pass only the specific settings you wish to update. \ 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 cb06d4a7f3..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. You can pass only the specific settings you wish to update. \ 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 fc615fef8e..2b0da9965b 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -3,6 +3,7 @@ namespace Tests\E2E\Services\Account; use Tests\E2E\Client; +use function array_merge; trait AccountBase { @@ -751,6 +752,36 @@ trait AccountBase $this->assertEquals($response['headers']['status-code'], 400); + /** + * Prefs size exceeded + */ + $prefsObject = ["longValue" => str_repeat("🍰", 100000)]; + + $response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session, + ]), [ + 'prefs' => $prefsObject + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + + // Now let's test the same thing, but with normal symbol instead of multi-byte cake emoji + $prefsObject = ["longValue" => str_repeat("-", 100000)]; + + $response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session, + ]), [ + 'prefs' => $prefsObject + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + return $data; }