From 2021dea93698f75ad9ce2ee8ed0e9e56c22fd8ea Mon Sep 17 00:00:00 2001 From: Lucas Reis Date: Sun, 26 Feb 2023 19:31:56 +0000 Subject: [PATCH 01/27] set correct value for logging drivers set correct value for logOwl and appSignal logging drivers --- app/config/variables.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/variables.php b/app/config/variables.php index 193e167b8f..2dcb8d6362 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -152,7 +152,7 @@ return [ ], [ 'name' => '_APP_LOGGING_PROVIDER', - 'description' => 'This variable allows you to enable logging errors to 3rd party providers. This value is empty by default, to enable the logger set the value to one of \'sentry\', \'raygun\', \'appsignal\', \'logowl\'', + 'description' => 'This variable allows you to enable logging errors to 3rd party providers. This value is empty by default, to enable the logger set the value to one of \'sentry\', \'raygun\', \'appSignal\', \'logOwl\'', 'introduction' => '0.12.0', 'default' => '', 'required' => false, From ac2085ffa83bc4e2fd0810c2f3b2c4f6ddcbfe22 Mon Sep 17 00:00:00 2001 From: Bhaskar Singh Date: Sat, 18 Mar 2023 22:03:15 +0530 Subject: [PATCH 02/27] Updated error when _APP_USAGE_STATS is disabled for usage --- app/config/errors.php | 5 +++++ app/console | 2 +- app/controllers/api/databases.php | 9 +++++++++ app/controllers/api/functions.php | 6 ++++++ app/controllers/api/projects.php | 3 +++ app/controllers/api/storage.php | 6 ++++++ app/controllers/api/users.php | 3 +++ src/Appwrite/Extend/Exception.php | 1 + 8 files changed, 34 insertions(+), 1 deletion(-) diff --git a/app/config/errors.php b/app/config/errors.php index 266e017e93..852b103dc5 100644 --- a/app/config/errors.php +++ b/app/config/errors.php @@ -88,6 +88,11 @@ return [ 'description' => 'The request cannot be fulfilled with the current protocol. Please check the value of the _APP_OPTIONS_FORCE_HTTPS environment variable.', 'code' => 500, ], + Exception::GENERAL_USAGE_DISABLED => [ + 'name' => Exception::GENERAL_USAGE_DISABLED, + 'description' => 'Usage stats is not configured. Please check the value of the _APP_USAGE_STATS environment variable of your Appwrite server.', + 'code' => 501, + ], /** User Errors */ Exception::USER_COUNT_EXCEEDED => [ diff --git a/app/console b/app/console index 5e2a40c1e3..d30a4070d0 160000 --- a/app/console +++ b/app/console @@ -1 +1 @@ -Subproject commit 5e2a40c1e397bd341a432698c9d76a3f96315841 +Subproject commit d30a4070d0bdf8fe89be23a141e261a8a8688246 diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 9ec46817ac..4c80bfe645 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -2471,6 +2471,9 @@ App::get('/v1/databases/usage') ->action(function (string $range, Response $response, Database $dbForProject) { $usage = []; + if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { + throw new Exception(Exception::GENERAL_USAGE_DISABLED); + } if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $periods = [ '24h' => [ @@ -2590,6 +2593,9 @@ App::get('/v1/databases/:databaseId/usage') ->action(function (string $databaseId, string $range, Response $response, Database $dbForProject) { $usage = []; + if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { + throw new Exception(Exception::GENERAL_USAGE_DISABLED); + } if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $periods = [ '24h' => [ @@ -2710,6 +2716,9 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/usage') } $usage = []; + if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { + throw new Exception(Exception::GENERAL_USAGE_DISABLED); + } if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $periods = [ '24h' => [ diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 049d2cb850..f91784bb22 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -234,6 +234,9 @@ App::get('/v1/functions/:functionId/usage') } $usage = []; + if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { + throw new Exception(Exception::GENERAL_USAGE_DISABLED); + } if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $periods = [ '24h' => [ @@ -337,6 +340,9 @@ App::get('/v1/functions/usage') ->action(function (string $range, Response $response, Database $dbForProject) { $usage = []; + if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { + throw new Exception(Exception::GENERAL_USAGE_DISABLED); + } if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $periods = [ '24h' => [ diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 29a193748d..b615b3555c 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -268,6 +268,9 @@ App::get('/v1/projects/:projectId/usage') } $usage = []; + if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { + throw new Exception(Exception::GENERAL_USAGE_DISABLED); + } if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $periods = [ '24h' => [ diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index 271f2af6b3..ff8dd3ca2c 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -1461,6 +1461,9 @@ App::get('/v1/storage/usage') ->action(function (string $range, Response $response, Database $dbForProject) { $usage = []; + if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { + throw new Exception(Exception::GENERAL_USAGE_DISABLED); + } if (App::getEnv('_APP_USAGE_STATS', 'enabled') === 'enabled') { $periods = [ '24h' => [ @@ -1578,6 +1581,9 @@ App::get('/v1/storage/:bucketId/usage') } $usage = []; + if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { + throw new Exception(Exception::GENERAL_USAGE_DISABLED); + } if (App::getEnv('_APP_USAGE_STATS', 'enabled') === 'enabled') { $periods = [ '24h' => [ diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 2a84c06675..96d6017848 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -1114,6 +1114,9 @@ App::get('/v1/users/usage') ->action(function (string $range, string $provider, Response $response, Database $dbForProject) { $usage = []; + if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { + throw new Exception(Exception::GENERAL_USAGE_DISABLED); + } if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $periods = [ '24h' => [ diff --git a/src/Appwrite/Extend/Exception.php b/src/Appwrite/Extend/Exception.php index 8b240aa971..f072fcfad3 100644 --- a/src/Appwrite/Extend/Exception.php +++ b/src/Appwrite/Extend/Exception.php @@ -51,6 +51,7 @@ class Exception extends \Exception public const GENERAL_CURSOR_NOT_FOUND = 'general_cursor_not_found'; public const GENERAL_SERVER_ERROR = 'general_server_error'; public const GENERAL_PROTOCOL_UNSUPPORTED = 'general_protocol_unsupported'; + public const GENERAL_USAGE_DISABLED = 'general_usage_disabled'; /** Users */ public const USER_COUNT_EXCEEDED = 'user_count_exceeded'; From 5071172b00196ec7b87a8eb82168a43996e85883 Mon Sep 17 00:00:00 2001 From: Bhaskar Singh Date: Tue, 21 Mar 2023 21:26:22 +0530 Subject: [PATCH 03/27] Updating the console code --- app/console | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/console b/app/console index d30a4070d0..b9f3d61d9f 160000 --- a/app/console +++ b/app/console @@ -1 +1 @@ -Subproject commit d30a4070d0bdf8fe89be23a141e261a8a8688246 +Subproject commit b9f3d61d9f97b6bb17a1078d6418d4141ad011c2 From 6324d78a0d0588d7e13c32b453e74053cfdcd4cd Mon Sep 17 00:00:00 2001 From: Bhaskar Singh Date: Tue, 21 Mar 2023 21:30:49 +0530 Subject: [PATCH 04/27] Update the console app commit --- app/console | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/console b/app/console index b9f3d61d9f..7bc1d187e0 160000 --- a/app/console +++ b/app/console @@ -1 +1 @@ -Subproject commit b9f3d61d9f97b6bb17a1078d6418d4141ad011c2 +Subproject commit 7bc1d187e0e9bb22f28425f04c75a79ceaa5e00e From 01840b38016643c5dbae3c2eb90d84ccc84b7fb9 Mon Sep 17 00:00:00 2001 From: Bhaskar Singh Date: Fri, 24 Mar 2023 21:46:12 +0530 Subject: [PATCH 05/27] Reverting console change from main repo --- app/console | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/console b/app/console index 7bc1d187e0..5e2a40c1e3 160000 --- a/app/console +++ b/app/console @@ -1 +1 @@ -Subproject commit 7bc1d187e0e9bb22f28425f04c75a79ceaa5e00e +Subproject commit 5e2a40c1e397bd341a432698c9d76a3f96315841 From 0a1fcfc889f0ddfd3fa1d32a91411c7e38b32406 Mon Sep 17 00:00:00 2001 From: Prasanth Kota Date: Thu, 13 Apr 2023 00:13:20 +0530 Subject: [PATCH 06/27] Update GETTING_STARTED.md --- docs/sdks/web/GETTING_STARTED.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sdks/web/GETTING_STARTED.md b/docs/sdks/web/GETTING_STARTED.md index 2c09704af2..445a362c05 100644 --- a/docs/sdks/web/GETTING_STARTED.md +++ b/docs/sdks/web/GETTING_STARTED.md @@ -57,7 +57,7 @@ account.create(ID.unique(), 'me@example.com', 'password', 'Jane Doe') ### Learn more You can use the following resources to learn more and get help -- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-flutter) +- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-web) - 📜 [Appwrite Docs](https://appwrite.io/docs) - 💬 [Discord Community](https://appwrite.io/discord) -- 🚂 [Appwrite Flutter Playground](https://github.com/appwrite/playground-for-flutter) +- 🚂 [Appwrite Web Playground](https://github.com/appwrite/playground-for-web) From 3865f48d320172aab8ea03d11c8a99b28dc69a3f Mon Sep 17 00:00:00 2001 From: Bhaskar Singh Date: Fri, 21 Apr 2023 23:09:01 +0530 Subject: [PATCH 07/27] Moved check for _APP_USAGE_STATS to create init hook for App --- app/controllers/api/databases.php | 15 +++------------ app/controllers/api/functions.php | 10 ++-------- app/controllers/api/projects.php | 5 +---- app/controllers/api/storage.php | 10 ++-------- app/controllers/api/users.php | 5 +---- app/controllers/shared/api.php | 9 +++++++++ 6 files changed, 18 insertions(+), 36 deletions(-) diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 4c80bfe645..b97c3f77c3 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -2457,7 +2457,7 @@ App::delete('/v1/databases/:databaseId/collections/:collectionId/documents/:docu App::get('/v1/databases/usage') ->desc('Get usage stats for the database') - ->groups(['api', 'database']) + ->groups(['api', 'database', 'usage']) ->label('scope', 'collections.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) ->label('sdk.namespace', 'databases') @@ -2471,9 +2471,6 @@ App::get('/v1/databases/usage') ->action(function (string $range, Response $response, Database $dbForProject) { $usage = []; - if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { - throw new Exception(Exception::GENERAL_USAGE_DISABLED); - } if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $periods = [ '24h' => [ @@ -2578,7 +2575,7 @@ App::get('/v1/databases/usage') App::get('/v1/databases/:databaseId/usage') ->desc('Get usage stats for the database') - ->groups(['api', 'database']) + ->groups(['api', 'database', 'usage']) ->label('scope', 'collections.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) ->label('sdk.namespace', 'databases') @@ -2593,9 +2590,6 @@ App::get('/v1/databases/:databaseId/usage') ->action(function (string $databaseId, string $range, Response $response, Database $dbForProject) { $usage = []; - if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { - throw new Exception(Exception::GENERAL_USAGE_DISABLED); - } if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $periods = [ '24h' => [ @@ -2691,7 +2685,7 @@ App::get('/v1/databases/:databaseId/usage') App::get('/v1/databases/:databaseId/collections/:collectionId/usage') ->alias('/v1/database/:collectionId/usage', ['databaseId' => 'default']) ->desc('Get usage stats for a collection') - ->groups(['api', 'database']) + ->groups(['api', 'database', 'usage']) ->label('scope', 'collections.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) ->label('sdk.namespace', 'databases') @@ -2716,9 +2710,6 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/usage') } $usage = []; - if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { - throw new Exception(Exception::GENERAL_USAGE_DISABLED); - } if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $periods = [ '24h' => [ diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index f91784bb22..1a7f9bdb2e 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -213,7 +213,7 @@ App::get('/v1/functions/:functionId') App::get('/v1/functions/:functionId/usage') ->desc('Get Function Usage') - ->groups(['api', 'functions']) + ->groups(['api', 'functions', 'usage']) ->label('scope', 'functions.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) ->label('sdk.namespace', 'functions') @@ -234,9 +234,6 @@ App::get('/v1/functions/:functionId/usage') } $usage = []; - if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { - throw new Exception(Exception::GENERAL_USAGE_DISABLED); - } if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $periods = [ '24h' => [ @@ -326,7 +323,7 @@ App::get('/v1/functions/:functionId/usage') App::get('/v1/functions/usage') ->desc('Get Functions Usage') - ->groups(['api', 'functions']) + ->groups(['api', 'functions', 'usage']) ->label('scope', 'functions.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) ->label('sdk.namespace', 'functions') @@ -340,9 +337,6 @@ App::get('/v1/functions/usage') ->action(function (string $range, Response $response, Database $dbForProject) { $usage = []; - if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { - throw new Exception(Exception::GENERAL_USAGE_DISABLED); - } if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $periods = [ '24h' => [ diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index dd703be67b..55b3ef2bb8 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -245,7 +245,7 @@ App::get('/v1/projects/:projectId') App::get('/v1/projects/:projectId/usage') ->desc('Get usage stats for a project') - ->groups(['api', 'projects']) + ->groups(['api', 'projects', 'usage']) ->label('scope', 'projects.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) ->label('sdk.namespace', 'projects') @@ -268,9 +268,6 @@ App::get('/v1/projects/:projectId/usage') } $usage = []; - if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { - throw new Exception(Exception::GENERAL_USAGE_DISABLED); - } if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $periods = [ '24h' => [ diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index ff8dd3ca2c..0c20ffec3c 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -1447,7 +1447,7 @@ App::delete('/v1/storage/buckets/:bucketId/files/:fileId') App::get('/v1/storage/usage') ->desc('Get usage stats for storage') - ->groups(['api', 'storage']) + ->groups(['api', 'storage', 'usage']) ->label('scope', 'files.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) ->label('sdk.namespace', 'storage') @@ -1461,9 +1461,6 @@ App::get('/v1/storage/usage') ->action(function (string $range, Response $response, Database $dbForProject) { $usage = []; - if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { - throw new Exception(Exception::GENERAL_USAGE_DISABLED); - } if (App::getEnv('_APP_USAGE_STATS', 'enabled') === 'enabled') { $periods = [ '24h' => [ @@ -1560,7 +1557,7 @@ App::get('/v1/storage/usage') App::get('/v1/storage/:bucketId/usage') ->desc('Get usage stats for a storage bucket') - ->groups(['api', 'storage']) + ->groups(['api', 'storage', 'usage']) ->label('scope', 'files.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) ->label('sdk.namespace', 'storage') @@ -1581,9 +1578,6 @@ App::get('/v1/storage/:bucketId/usage') } $usage = []; - if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { - throw new Exception(Exception::GENERAL_USAGE_DISABLED); - } if (App::getEnv('_APP_USAGE_STATS', 'enabled') === 'enabled') { $periods = [ '24h' => [ diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 96d6017848..930862994b 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -1098,7 +1098,7 @@ App::delete('/v1/users/:userId') App::get('/v1/users/usage') ->desc('Get usage stats for the users API') - ->groups(['api', 'users']) + ->groups(['api', 'users', 'usage']) ->label('scope', 'users.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) ->label('sdk.namespace', 'users') @@ -1114,9 +1114,6 @@ App::get('/v1/users/usage') ->action(function (string $range, string $provider, Response $response, Database $dbForProject) { $usage = []; - if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { - throw new Exception(Exception::GENERAL_USAGE_DISABLED); - } if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $periods = [ '24h' => [ diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 5655874c65..ae1501a5ad 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -554,3 +554,12 @@ App::shutdown() ->submit(); } }); + +App::init() + ->groups(['usage']) + ->inject('utopia') + ->action(function (App $utopia) { + if ($utopia::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { + throw new Exception(Exception::GENERAL_USAGE_DISABLED); + } + }); From 7064f884aac66eb9a2a8325e2ed4c410bd883977 Mon Sep 17 00:00:00 2001 From: Bhaskar Singh Date: Thu, 27 Apr 2023 19:32:05 +0530 Subject: [PATCH 08/27] Refactor usage init hook to remove unecessary inject --- app/controllers/shared/api.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index ae1501a5ad..256e9973c2 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -557,9 +557,8 @@ App::shutdown() App::init() ->groups(['usage']) - ->inject('utopia') - ->action(function (App $utopia) { - if ($utopia::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { + ->action(function () { + if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { throw new Exception(Exception::GENERAL_USAGE_DISABLED); } }); From 169b3c3605274d281bc153cbb59ce8ae9b2ec145 Mon Sep 17 00:00:00 2001 From: Steven <1477010+stnguyen90@users.noreply.github.com> Date: Thu, 27 Apr 2023 13:40:25 -0700 Subject: [PATCH 09/27] Update CHANGES.md to include team prefs fix --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index df4bc7105e..6faf0b966c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,7 @@ - Fixed auto-setting custom ID on nested documents [#5363](https://github.com/appwrite/appwrite/pull/5363) - Fixed listDocuments not returning all the documents [#5395](https://github.com/appwrite/appwrite/pull/5395) - Fixed deleting keys, webhooks, platforms and domains after deleting project [#5395](https://github.com/appwrite/appwrite/pull/5395) +- Fixed empty team prefs returning as JSON object rather array [#5361](https://github.com/appwrite/appwrite/pull/5361) # Version 1.3.1 From a0297bfb8b95144831003fd98a493e8fd88b3d34 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Fri, 28 Apr 2023 12:47:51 -0700 Subject: [PATCH 10/27] Fix the release github action job name --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6f8ea5fa93..d811c75631 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ on: jobs: tests: - name: Unit & E2E + name: Release runs-on: ubuntu-latest steps: From 5d651b9e8aeb27d08332f4820e4237c870974587 Mon Sep 17 00:00:00 2001 From: Steven <1477010+stnguyen90@users.noreply.github.com> Date: Sun, 30 Apr 2023 12:34:55 -0700 Subject: [PATCH 11/27] Update install.php not specify docker-compose.yml file By not specifying a docker-compose.yml file, docker compose automatically uses the docker-compose.yml file in the project directory and a docker-compose.override.yml file if one is present. --- app/tasks/install.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/tasks/install.php b/app/tasks/install.php index 0f15af2eda..651042664b 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -224,9 +224,9 @@ $cli } } - Console::log("Running \"docker compose -f {$path}/docker-compose.yml up -d --remove-orphans --renew-anon-volumes\""); + Console::log("Running \"docker compose up -d --remove-orphans --renew-anon-volumes\""); - $exit = Console::execute("${env} docker compose -f {$path}/docker-compose.yml up -d --remove-orphans --renew-anon-volumes", '', $stdout, $stderr); + $exit = Console::execute("${env} docker compose --project-directory {$path} up -d --remove-orphans --renew-anon-volumes", '', $stdout, $stderr); if ($exit !== 0) { $message = 'Failed to install Appwrite dockers'; From 6e65178ad5834ff808fb8069e367650ee82c0973 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 2 May 2023 12:54:20 +0545 Subject: [PATCH 12/27] Update README.md --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 268a30fd16..816e0b28a6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -> It's going to get cloudy! 🌩 ☂️ -> The Appwrite Cloud is coming soon! You can learn more about our upcoming hosted solution and signup for free credits at: https://appwrite.io/cloud +> The Appwrite Cloud is now live in public beta and ready for you to use! Say goodbye to the hassle of self-hosting and enjoy a seamless, hosted experience. To get started, sign up now at [cloud.appwrite.io](https://cloud.appwrite.io). We can't wait for you to experience the power and convenience of our new hosted solution. See you in the Cloud!" 🌥️☁️

@@ -25,7 +24,7 @@ English | [简体中文](README-CN.md) -[**Announcing Appwrite 1.3 with Database Relationships! Learn what's new!**](https://dev.to/appwrite/join-celebrations-appwrite-13-ships-relationships-57fc) +[**Announcing Appwrite Cloud Public Beta! Sign up today!**](https://cloud.appwrite.io) Appwrite is an end-to-end backend server for Web, Mobile, Native, or Backend apps packaged as a set of Docker microservices. Appwrite abstracts the complexity and repetitiveness required to build a modern backend API from scratch and allows you to build secure apps faster. From a5fa150c25da279c33ac59d5aea9582135f44769 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 2 May 2023 12:55:40 +0545 Subject: [PATCH 13/27] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 816e0b28a6..f063fd473d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -> The Appwrite Cloud is now live in public beta and ready for you to use! Say goodbye to the hassle of self-hosting and enjoy a seamless, hosted experience. To get started, sign up now at [cloud.appwrite.io](https://cloud.appwrite.io). We can't wait for you to experience the power and convenience of our new hosted solution. See you in the Cloud!" 🌥️☁️ +> The Appwrite Cloud is now live in public beta and ready for you to use! Say goodbye to the hassle of self-hosting and enjoy a seamless, hosted experience. To get started, sign up now at [cloud.appwrite.io](https://cloud.appwrite.io). We can't wait for you to experience the power and convenience of our new hosted solution. See you in the Cloud!" 🌥️

From 2eafda4ee232311d344aa8d3d9c54286e73547ad Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 2 May 2023 19:53:11 +1200 Subject: [PATCH 14/27] Fix update document merging existing data after pre-processing instead of before --- app/controllers/api/databases.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 8419d0d437..498af87dca 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -3279,6 +3279,7 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/documents/:docum $permissions = $document->getPermissions() ?? []; } + $data = \array_merge($document->getArrayCopy(), $data); // Merge existing data with new data $data['$collection'] = $collection->getId(); // Make sure user doesn't switch collectionID $data['$createdAt'] = $document->getCreatedAt(); // Make sure user doesn't switch createdAt $data['$id'] = $document->getId(); // Make sure user doesn't switch document unique ID @@ -3368,8 +3369,6 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/documents/:docum $checkPermissions($collection, $newDocument, $document, Database::PERMISSION_UPDATE); - $newDocument = new Document(\array_merge($document->getArrayCopy(), $data)); - try { $document = $dbForProject->withRequestTimestamp( $requestTimestamp, From 789198d523750f83e06515b23aeb4125088f6876 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 2 May 2023 13:38:47 +0545 Subject: [PATCH 15/27] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f063fd473d..5bd24979b3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -> The Appwrite Cloud is now live in public beta and ready for you to use! Say goodbye to the hassle of self-hosting and enjoy a seamless, hosted experience. To get started, sign up now at [cloud.appwrite.io](https://cloud.appwrite.io). We can't wait for you to experience the power and convenience of our new hosted solution. See you in the Cloud!" 🌥️ +> Great news! Appwrite Cloud is now live! Sign up at https://cloud.appwrite.io/ for a hassle-free, hosted experience. Join us in the Cloud today! ☁️🎉

From 970457045f890a2c18268339ea5d7695213ed495 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 2 May 2023 13:47:40 +0545 Subject: [PATCH 16/27] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5bd24979b3..3902bcf689 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -> Great news! Appwrite Cloud is now live! Sign up at https://cloud.appwrite.io/ for a hassle-free, hosted experience. Join us in the Cloud today! ☁️🎉 +> Great news! Appwrite Cloud is now live! Sign up at [cloud.appwrite.io](https://cloud.appwrite.io) for a hassle-free, hosted experience. Join us in the Cloud today! ☁️🎉

From 3c5bebc34edd77164c8edeb0ed232f7e001d812a Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 2 May 2023 14:02:57 +0545 Subject: [PATCH 17/27] Update README.md Co-authored-by: Eldad A. Fux --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3902bcf689..da2314483d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -> Great news! Appwrite Cloud is now live! Sign up at [cloud.appwrite.io](https://cloud.appwrite.io) for a hassle-free, hosted experience. Join us in the Cloud today! ☁️🎉 +> Great news! Appwrite Cloud is now in public beta! Sign up at [cloud.appwrite.io](https://cloud.appwrite.io) for a hassle-free, hosted experience. Join us in the Cloud today! ☁️🎉

From 30237ccfb1b7b2f4cb03135408713b6c64bb3620 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 2 May 2023 20:27:09 +1200 Subject: [PATCH 18/27] Add test for updating existing document with relationship --- .../e2e/Services/Databases/DatabasesBase.php | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index abff3437b8..0648db849e 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -3968,4 +3968,105 @@ trait DatabasesBase $this->assertArrayHasKey('fullName', $response['body']); $this->assertArrayNotHasKey('libraries', $response['body']); } + + /** + * @depends testCreateDatabase + * @param array $data + * @return void + * @throws \Exception + */ + public function testUpdateWithExistingRelationships(array $data): void + { + $databaseId = $data['databaseId']; + + $collection1 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'collectionId' => ID::unique(), + 'name' => 'Collection1', + 'documentSecurity' => true, + 'permissions' => [ + Permission::create(Role::user($this->getUser()['$id'])), + Permission::read(Role::user($this->getUser()['$id'])), + ], + ]); + + $collection2 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'collectionId' => ID::unique(), + 'name' => 'Collection2', + 'documentSecurity' => true, + 'permissions' => [ + Permission::create(Role::user($this->getUser()['$id'])), + Permission::read(Role::user($this->getUser()['$id'])), + ], + ]); + + $collection1 = $collection1['body']['$id']; + $collection2 = $collection2['body']['$id']; + + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collection1 . '/attributes/string', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'name', + 'size' => '49', + 'required' => true, + ]); + + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collection2 . '/attributes/string', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'name', + 'size' => '49', + 'required' => true, + ]); + + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collection1 . '/attributes/relationship', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'relatedCollectionId' => $collection2, + 'type' => Database::RELATION_ONE_TO_MANY, + 'twoWay' => true, + 'key' => 'collection2' + ]); + + sleep(1); + + $document = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collection1 . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'] + ], $this->getHeaders()), [ + 'documentId' => ID::unique(), + 'data' => [ + 'name' => 'Document 1', + 'collection2' => [ + [ + 'name' => 'Document 2', + ], + ], + ], + ]); + + $update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collection1 . '/documents/' . $document['body']['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'] + ], $this->getHeaders()), [ + 'data' => [ + 'name' => 'Document 1 Updated', + ], + ]); + + $this->assertEquals(200, $update['headers']['status-code']); + } } From 17acfd5d1c3d938a37c222e9c4b219f1cd6226c5 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Tue, 2 May 2023 09:49:55 -0400 Subject: [PATCH 19/27] Update README-CN.md --- README-CN.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README-CN.md b/README-CN.md index 9a6262e8d9..5177a4a725 100644 --- a/README-CN.md +++ b/README-CN.md @@ -1,5 +1,4 @@ -> 准备好迎接狂风暴'云'了吗? 🌩 ☂️ -> Appwrite Cloud即将到来!你能够通过https://appwrite.io/cloud了解更多的资讯, 注册即可领取试用额度哦 +> 好消息!Appwrite 云现已进入公开测试版!立即访问 cloud.appwrite.io 注册,体验无忧的托管服务。今天就加入我们的云端吧!☁️🎉

@@ -24,7 +23,7 @@ [English](README.md) | 简体中文 -[**宣布带有数据库关系的 Appwrite 1.3!了解最新消息!**](https://dev.to/appwrite/join-celebrations-appwrite-13-ships-relationships-57fc) +[**Appwrite 云公开测试版!立即注册!**](https://cloud.appwrite.io) Appwrite是一个基于Docker的端到端开发者平台,其容器化的微服务库可应用于网页端,移动端,以及后端。Appwrite 通过视觉化界面简化了从零开始编写 API 的繁琐过程,在保证软件安全的前提下为开发者创造了一个高效的开发环境。 From a4299a69ef77864951aa3fe351b80e6455454182 Mon Sep 17 00:00:00 2001 From: Bhaskar Singh Date: Tue, 2 May 2023 23:47:50 +0530 Subject: [PATCH 20/27] Refactored the condition for strict inequality --- app/controllers/shared/api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 256e9973c2..14d0ff44e4 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -558,7 +558,7 @@ App::shutdown() App::init() ->groups(['usage']) ->action(function () { - if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') { + if (App::getEnv('_APP_USAGE_STATS', 'enabled') !== 'enabled') { throw new Exception(Exception::GENERAL_USAGE_DISABLED); } }); From 9898005465f4fda229387cf6181c893933789306 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Tue, 2 May 2023 17:38:16 -0700 Subject: [PATCH 21/27] Fix the version passed into the docker build command Change the order of the tags to ensure the version passed into the docker build command is the full major.minor.patch version. --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d811c75631..4475a49809 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,9 +37,9 @@ jobs: with: images: appwrite/appwrite tags: | - type=semver,pattern={{major}} - type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}}.{{minor}}.{{patch}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} - name: Build and push uses: docker/build-push-action@v4 From afd2c7a065d266db90088565044924362eccc78d Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Wed, 3 May 2023 12:03:23 -0700 Subject: [PATCH 22/27] Update migration to set bucket permissions in metadata table --- src/Appwrite/Migration/Version/V18.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Appwrite/Migration/Version/V18.php b/src/Appwrite/Migration/Version/V18.php index e55d62b0c5..be628e0fbb 100644 --- a/src/Appwrite/Migration/Version/V18.php +++ b/src/Appwrite/Migration/Version/V18.php @@ -182,6 +182,19 @@ class V18 extends Migration */ $document->setAttribute('options', $document->getAttribute('options', new \stdClass())); break; + case 'buckets': + /** + * Set the bucket permission in the metadata table + */ + try { + $internalBucketId = "bucket_{$this->project->getInternalId()}"; + $permissions = $document->getPermissions(); + $fileSecurity = $document->getAttribute('fileSecurity', false); + $this->projectDB->updateCollection($internalBucketId, $permissions, $fileSecurity); + } catch (\Throwable $th) { + Console::warning($th->getMessage()); + } + break; } return $document; From 4dd6a7977ef5a741d65141a6da89b916b2fc4d22 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Wed, 3 May 2023 12:06:36 -0700 Subject: [PATCH 23/27] Update create and update bucket APIs Ensure the permissions and document security are updated in the metadata collection. --- app/controllers/api/storage.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index b936fc6b2f..ed36880454 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -128,7 +128,7 @@ App::post('/v1/storage/buckets') $bucket = $dbForProject->getDocument('buckets', $bucketId); - $dbForProject->createCollection('bucket_' . $bucket->getInternalId(), $attributes, $indexes); + $dbForProject->createCollection('bucket_' . $bucket->getInternalId(), $attributes, $indexes, permissions: $permissions ?? [], documentSecurity: $fileSecurity); } catch (Duplicate) { throw new Exception(Exception::STORAGE_BUCKET_ALREADY_EXISTS); } @@ -274,6 +274,7 @@ App::put('/v1/storage/buckets/:bucketId') ->setAttribute('encryption', $encryption) ->setAttribute('compression', $compression) ->setAttribute('antivirus', $antivirus)); + $dbForProject->updateCollection('bucket_' . $bucket->getInternalId(), $permissions, $fileSecurity); $events ->setParam('bucketId', $bucket->getId()) From c46a02b49629f6286a5a4cb84130e1038f18ecf2 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Wed, 3 May 2023 12:13:58 -0700 Subject: [PATCH 24/27] Update CHANGES.md --- CHANGES.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 84137981c9..b77ca2e3ce 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +# Version 1.3.4 + +## Bugs + +- Update migration to properly migrate bucket permissiosn [#5497](https://github.com/appwrite/appwrite/pull/5497) + # Version 1.3.3 ## Bugs From d7bbfb55eda3211d707053a58d6570b3797b6275 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Wed, 3 May 2023 13:39:05 -0700 Subject: [PATCH 25/27] Prepare 1.3.4 release --- README-CN.md | 6 +++--- README.md | 6 +++--- app/init.php | 2 +- src/Appwrite/Migration/Migration.php | 1 + 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README-CN.md b/README-CN.md index 9a6262e8d9..e8e6a8c8f2 100644 --- a/README-CN.md +++ b/README-CN.md @@ -67,7 +67,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:1.3.3 + appwrite/appwrite:1.3.4 ``` ### Windows @@ -79,7 +79,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:1.3.3 + appwrite/appwrite:1.3.4 ``` #### PowerShell @@ -89,7 +89,7 @@ docker run -it --rm ` --volume /var/run/docker.sock:/var/run/docker.sock ` --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ` --entrypoint="install" ` - appwrite/appwrite:1.3.3 + appwrite/appwrite:1.3.4 ``` 运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。 diff --git a/README.md b/README.md index 5c98ed6c6f..5ea99747a4 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:1.3.3 + appwrite/appwrite:1.3.4 ``` ### Windows @@ -89,7 +89,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:1.3.3 + appwrite/appwrite:1.3.4 ``` #### PowerShell @@ -99,7 +99,7 @@ docker run -it --rm ` --volume /var/run/docker.sock:/var/run/docker.sock ` --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ` --entrypoint="install" ` - appwrite/appwrite:1.3.3 + appwrite/appwrite:1.3.4 ``` Once the Docker installation is complete, go to http://localhost to access the Appwrite console from your browser. Please note that on non-Linux native hosts, the server might take a few minutes to start after completing the installation. diff --git a/app/init.php b/app/init.php index b5def038c1..2dd01d2134 100644 --- a/app/init.php +++ b/app/init.php @@ -101,7 +101,7 @@ const APP_LIMIT_LIST_DEFAULT = 25; // Default maximum number of items to return const APP_KEY_ACCCESS = 24 * 60 * 60; // 24 hours const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours const APP_CACHE_BUSTER = 503; -const APP_VERSION_STABLE = '1.3.3'; +const APP_VERSION_STABLE = '1.3.4'; const APP_DATABASE_ATTRIBUTE_EMAIL = 'email'; const APP_DATABASE_ATTRIBUTE_ENUM = 'enum'; const APP_DATABASE_ATTRIBUTE_IP = 'ip'; diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index 9ce1d262fc..397d41efdd 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -59,6 +59,7 @@ abstract class Migration '1.3.1' => 'V18', '1.3.2' => 'V18', '1.3.3' => 'V18', + '1.3.4' => 'V18', ]; /** From fc36120a510ced559ec83d6b63eaf8e0b9c25f6f Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 7 May 2023 11:33:27 +0545 Subject: [PATCH 26/27] get file hash before encryption and compression --- app/controllers/api/storage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index de19590f25..d59d950d93 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -515,6 +515,7 @@ App::post('/v1/storage/buckets/:bucketId/files') } $mimeType = $deviceFiles->getFileMimeType($path); // Get mime-type before compression and encryption + $fileHash = $deviceFiles->getFileHash($path); // Get file hash before compression and encryption $data = ''; // Compression $algorithm = $bucket->getAttribute('compression', COMPRESSION_TYPE_NONE); @@ -548,7 +549,6 @@ App::post('/v1/storage/buckets/:bucketId/files') } $sizeActual = $deviceFiles->getFileSize($path); - $fileHash = $deviceFiles->getFileHash($path); $openSSLVersion = null; $openSSLCipher = null; From 0592384d840bae5a4d3ba7a6478dd313cf8ec696 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 10 May 2023 06:31:12 +0000 Subject: [PATCH 27/27] fix test --- tests/e2e/Services/Storage/StorageBase.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/e2e/Services/Storage/StorageBase.php b/tests/e2e/Services/Storage/StorageBase.php index baef838979..3169077f99 100644 --- a/tests/e2e/Services/Storage/StorageBase.php +++ b/tests/e2e/Services/Storage/StorageBase.php @@ -57,8 +57,7 @@ trait StorageBase $this->assertEquals('logo.png', $file['body']['name']); $this->assertEquals('image/png', $file['body']['mimeType']); $this->assertEquals(47218, $file['body']['sizeOriginal']); - $this->assertTrue(md5_file(realpath(__DIR__ . '/../../../resources/logo.png')) != $file['body']['signature']); // should validate that the file is encrypted - + $this->assertTrue(md5_file(realpath(__DIR__ . '/../../../resources/logo.png')) == $file['body']['signature']); /** * Test for Large File above 20MB * This should also validate the test for when Bucket encryption @@ -289,7 +288,7 @@ trait StorageBase $this->assertEquals('logo.png', $file['body']['name']); $this->assertEquals('image/png', $file['body']['mimeType']); $this->assertEquals(47218, $file['body']['sizeOriginal']); - $this->assertTrue(md5_file(realpath(__DIR__ . '/../../../resources/logo.png')) != $file['body']['signature']); // should validate that the file is encrypted + $this->assertTrue(md5_file(realpath(__DIR__ . '/../../../resources/logo.png')) == $file['body']['signature']); return ['bucketId' => $bucketId]; }