diff --git a/app/config/collections/platform.php b/app/config/collections/platform.php index ce8be6a874..e53194c513 100644 --- a/app/config/collections/platform.php +++ b/app/config/collections/platform.php @@ -1148,7 +1148,7 @@ return [ 'format' => '', 'size' => 32, 'signed' => true, - 'required' => true, + 'required' => false, 'default' => null, 'array' => false, 'filters' => [], diff --git a/app/config/collections/projects.php b/app/config/collections/projects.php index 19547559e6..5105304599 100644 --- a/app/config/collections/projects.php +++ b/app/config/collections/projects.php @@ -1029,7 +1029,7 @@ return [ '$id' => ID::custom('fallbackFile'), 'type' => Database::VAR_STRING, 'format' => '', - 'size' => Database::LENGTH_KEY, + 'size' => 16384, 'signed' => true, 'required' => false, 'default' => null, @@ -1205,7 +1205,7 @@ return [ '$id' => ID::custom('adapter'), // ssr or static; named this way as it's a term in SSR frameworks 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 128, + 'size' => 16, 'signed' => true, 'required' => false, 'default' => '', @@ -1361,7 +1361,7 @@ return [ '$id' => ID::custom('sourcePath'), 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 2048, + 'size' => 16384, 'signed' => true, 'required' => false, 'default' => null, @@ -1372,7 +1372,7 @@ return [ '$id' => ID::custom('type'), 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 32, + 'size' => 2048, 'signed' => true, 'required' => true, 'default' => null, @@ -1699,7 +1699,7 @@ return [ 'format' => '', 'size' => 16, 'signed' => true, - 'required' => true, + 'required' => false, 'default' => 'waiting', 'array' => false, 'filters' => [], @@ -1708,7 +1708,7 @@ return [ '$id' => ID::custom('buildPath'), 'type' => Database::VAR_STRING, 'format' => '', - 'size' => Database::LENGTH_KEY, + 'size' => 16384, 'signed' => true, 'required' => false, 'default' => '', @@ -1730,7 +1730,7 @@ return [ '$id' => ID::custom('adapter'), // ssr or static; named this way as it's a term in SSR frameworks 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 128, + 'size' => 16, 'signed' => true, 'required' => false, 'default' => '', @@ -1741,7 +1741,7 @@ return [ '$id' => ID::custom('fallbackFile'), 'type' => Database::VAR_STRING, 'format' => '', - 'size' => Database::LENGTH_KEY, + 'size' => 16384, 'signed' => true, 'required' => false, 'default' => null, diff --git a/app/controllers/general.php b/app/controllers/general.php index 32323d6e05..f07fb2f178 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -150,7 +150,31 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw $dbForProject = $getProjectDB($project); /** @var Document $deployment */ - $deployment = Authorization::skip(fn () => $dbForProject->getDocument('deployments', $rule->getAttribute('deploymentId'))); + if (!empty($rule->getAttribute('deploymentId', ''))) { + $deployment = Authorization::skip(fn () => $dbForProject->getDocument('deployments', $rule->getAttribute('deploymentId'))); + } else { + // 1.6.x DB schema compatibility + // TODO: Make sure deploymentId is never empty, and remove this code + + // Check if site or function; should never be site, but better safe than sorry + // Attempts to use attribute from both schemas (1.6 and 1.7) + $resourceType = $rule->getAttribute('deploymentResourceType', $rule->getAttribute('resourceType', '')); + + // ID of site or function + $resourceId = $rule->getAttribute('deploymentResourceId', ''); + + // Document of site or function + $resource = $resourceType === 'function' ? + Authorization::skip(fn () => $dbForProject->getDocument('functions', $resourceId)) : + Authorization::skip(fn () => $dbForProject->getDocument('sites', $resourceId)); + + // ID of active deployments + // Attempts to use attribute from both schemas (1.6 and 1.7) + $activeDeploymentId = $resource->getAttribute('deploymentId', $resource->getAttribute('deployment', '')); + + // Get deployment document, as intended originally + $deployment = Authorization::skip(fn () => $dbForProject->getDocument('deployments', $activeDeploymentId)); + } if ($deployment->getAttribute('resourceType', '') === 'functions') { $type = 'function'; diff --git a/composer.lock b/composer.lock index 17b3b27078..a1b91ab2e6 100644 --- a/composer.lock +++ b/composer.lock @@ -3705,16 +3705,16 @@ }, { "name": "utopia-php/fetch", - "version": "0.4.1", + "version": "0.4.2", "source": { "type": "git", "url": "https://github.com/utopia-php/fetch.git", - "reference": "65095dac14037db0c822fb5e209e5bd3187a0303" + "reference": "83986d1be75a2fae4e684107fe70dd78a8e19b77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/fetch/zipball/65095dac14037db0c822fb5e209e5bd3187a0303", - "reference": "65095dac14037db0c822fb5e209e5bd3187a0303", + "url": "https://api.github.com/repos/utopia-php/fetch/zipball/83986d1be75a2fae4e684107fe70dd78a8e19b77", + "reference": "83986d1be75a2fae4e684107fe70dd78a8e19b77", "shasum": "" }, "require": { @@ -3738,9 +3738,9 @@ "description": "A simple library that provides an interface for making HTTP Requests.", "support": { "issues": "https://github.com/utopia-php/fetch/issues", - "source": "https://github.com/utopia-php/fetch/tree/0.4.1" + "source": "https://github.com/utopia-php/fetch/tree/0.4.2" }, - "time": "2025-04-14T07:34:27+00:00" + "time": "2025-04-25T13:48:02+00:00" }, { "name": "utopia-php/framework", @@ -5275,16 +5275,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.13.0", + "version": "1.13.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "024473a478be9df5fdaca2c793f2232fe788e414" + "reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/024473a478be9df5fdaca2c793f2232fe788e414", - "reference": "024473a478be9df5fdaca2c793f2232fe788e414", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/1720ddd719e16cf0db4eb1c6eca108031636d46c", + "reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c", "shasum": "" }, "require": { @@ -5323,7 +5323,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.13.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.1" }, "funding": [ { @@ -5331,7 +5331,7 @@ "type": "tidelift" } ], - "time": "2025-02-12T12:17:51+00:00" + "time": "2025-04-29T12:36:36+00:00" }, { "name": "nikic/php-parser", diff --git a/docker-compose.yml b/docker-compose.yml index 75e544a91b..acdec401cc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -213,7 +213,7 @@ services: appwrite-console: <<: *x-logging container_name: appwrite-console - image: appwrite/console:5.3.0-sites-rc.40 + image: appwrite/console:5.3.0-sites-rc.42 restart: unless-stopped networks: - appwrite diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Tokens/Buckets/Files/XList.php b/src/Appwrite/Platform/Modules/Storage/Http/Tokens/Buckets/Files/XList.php index a9d1ba1f49..e3e571ae32 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Tokens/Buckets/Files/XList.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Tokens/Buckets/Files/XList.php @@ -64,7 +64,7 @@ class XList extends Action $queries = Query::parseQueries($queries); $queries[] = Query::equal('resourceType', ["files"]); - $queries[] = Query::equal('resourceId', [$bucket->getInternalId() . ':' . $file->getInternalId()]); + $queries[] = Query::equal('resourceInternalId', [$bucket->getInternalId() . ':' . $file->getInternalId()]); // Get cursor document if there was a cursor query $cursor = \array_filter($queries, function ($query) { return \in_array($query->getMethod(), [Query::TYPE_CURSOR_AFTER, Query::TYPE_CURSOR_BEFORE]);