From 79375ad5b5f46ed49408357c4c8505d6455b8b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Tue, 19 Aug 2025 13:13:41 +0200 Subject: [PATCH 1/3] Reapply "http fix to double slashes and new domain validator" This reverts commit 09383f068f94b31b642197d5e60429880006cc14. --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 0855905a4a..922f5bf5ee 100644 --- a/composer.lock +++ b/composer.lock @@ -3852,16 +3852,16 @@ }, { "name": "utopia-php/framework", - "version": "0.33.20", + "version": "0.33.21", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "e1c7ab4e0b5b0a9a70256b1e00912e101e76a131" + "reference": "eb0e82e90b8fa493f99b8d131bdd25173422c493" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/e1c7ab4e0b5b0a9a70256b1e00912e101e76a131", - "reference": "e1c7ab4e0b5b0a9a70256b1e00912e101e76a131", + "url": "https://api.github.com/repos/utopia-php/http/zipball/eb0e82e90b8fa493f99b8d131bdd25173422c493", + "reference": "eb0e82e90b8fa493f99b8d131bdd25173422c493", "shasum": "" }, "require": { @@ -3893,9 +3893,9 @@ ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/0.33.20" + "source": "https://github.com/utopia-php/http/tree/0.33.21" }, - "time": "2025-05-18T23:51:21+00:00" + "time": "2025-08-19T10:52:15+00:00" }, { "name": "utopia-php/image", @@ -8426,5 +8426,5 @@ "platform-overrides": { "php": "8.3" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } From 6f5d0383409b4e63bbc33392ef53543022a1cd68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Tue, 19 Aug 2025 14:42:41 +0200 Subject: [PATCH 2/3] adjust tests to new domain validator --- tests/e2e/Services/Health/HealthCustomServerTest.php | 2 +- tests/e2e/Services/Proxy/ProxyCustomServerTest.php | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/e2e/Services/Health/HealthCustomServerTest.php b/tests/e2e/Services/Health/HealthCustomServerTest.php index 4b7062dc22..04f4c63ca1 100644 --- a/tests/e2e/Services/Health/HealthCustomServerTest.php +++ b/tests/e2e/Services/Health/HealthCustomServerTest.php @@ -453,7 +453,7 @@ class HealthCustomServerTest extends Scope $this->assertIsInt($response['body']['validFrom']); $this->assertIsInt($response['body']['validTo']); - $response = $this->client->call(Client::METHOD_GET, '/health/certificate?domain=https://google.com', array_merge([ + $response = $this->client->call(Client::METHOD_GET, '/health/certificate?domain=google.com', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), []); diff --git a/tests/e2e/Services/Proxy/ProxyCustomServerTest.php b/tests/e2e/Services/Proxy/ProxyCustomServerTest.php index ea310d5449..da23b9ab7c 100644 --- a/tests/e2e/Services/Proxy/ProxyCustomServerTest.php +++ b/tests/e2e/Services/Proxy/ProxyCustomServerTest.php @@ -109,15 +109,11 @@ class ProxyCustomServerTest extends Scope $rule = $this->createAPIRule('https://' . $domain); $this->assertEquals(400, $rule['headers']['status-code']); - // Unexpected I would say, but it is the current behaviour $rule = $this->createAPIRule('wss://' . $domain); - $this->assertEquals(201, $rule['headers']['status-code']); - $this->cleanupRule($rule['body']['$id']); + $this->assertEquals(400, $rule['headers']['status-code']); - // Unexpected I would say, but it is the current behaviour $rule = $this->createAPIRule($domain . '/some-path'); - $this->assertEquals(201, $rule['headers']['status-code']); - $this->cleanupRule($rule['body']['$id']); + $this->assertEquals(400, $rule['headers']['status-code']); } public function testCreateRedirectRule(): void From 52af439cacb0e9044b6bc0ba0ec75b1f6c7a0f67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Tue, 19 Aug 2025 16:43:31 +0200 Subject: [PATCH 3/3] Fix backwards comptibility --- app/controllers/api/health.php | 4 +++- tests/e2e/Services/Health/HealthCustomServerTest.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/health.php b/app/controllers/api/health.php index 32b77433f0..975db909c6 100644 --- a/app/controllers/api/health.php +++ b/app/controllers/api/health.php @@ -23,10 +23,12 @@ use Utopia\Storage\Device; use Utopia\Storage\Device\Local; use Utopia\Storage\Storage; use Utopia\System\System; +use Utopia\Validator\AnyOf; use Utopia\Validator\Domain; use Utopia\Validator\Integer; use Utopia\Validator\Multiple; use Utopia\Validator\Text; +use Utopia\Validator\URL; use Utopia\Validator\WhiteList; App::get('/v1/health') @@ -397,7 +399,7 @@ App::get('/v1/health/certificate') ], contentType: ContentType::JSON )) - ->param('domain', null, new Multiple([new Domain(), new PublicDomain()]), Multiple::TYPE_STRING, 'Domain name') + ->param('domain', null, new Multiple([new AnyOf([new URL(), new Domain()]), new PublicDomain()]), Multiple::TYPE_STRING, 'Domain name') ->inject('response') ->action(function (string $domain, Response $response) { if (filter_var($domain, FILTER_VALIDATE_URL)) { diff --git a/tests/e2e/Services/Health/HealthCustomServerTest.php b/tests/e2e/Services/Health/HealthCustomServerTest.php index 04f4c63ca1..4b7062dc22 100644 --- a/tests/e2e/Services/Health/HealthCustomServerTest.php +++ b/tests/e2e/Services/Health/HealthCustomServerTest.php @@ -453,7 +453,7 @@ class HealthCustomServerTest extends Scope $this->assertIsInt($response['body']['validFrom']); $this->assertIsInt($response['body']['validTo']); - $response = $this->client->call(Client::METHOD_GET, '/health/certificate?domain=google.com', array_merge([ + $response = $this->client->call(Client::METHOD_GET, '/health/certificate?domain=https://google.com', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), []);