From 5a5bc38f0f37b2ad3af6f440bb05a09c7ae7cbf3 Mon Sep 17 00:00:00 2001 From: Michael Engel Date: Wed, 30 Oct 2024 14:21:14 +0100 Subject: [PATCH 1/2] NTR - optimizes custom domain overwrite --- src/Service/Router/RoutingBuilder.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Service/Router/RoutingBuilder.php b/src/Service/Router/RoutingBuilder.php index 8d8700216..68e22a718 100644 --- a/src/Service/Router/RoutingBuilder.php +++ b/src/Service/Router/RoutingBuilder.php @@ -253,9 +253,7 @@ private function applyCustomDomain(string $url): string # then always use this one and override existing ones if ($customDomain !== '') { $components = parse_url($url); - $host = (is_array($components) && isset($components['host'])) ? (string)$components['host'] : ''; - # replace old domain with new custom domain - $url = str_replace($host, $customDomain, $url); + $url = $customDomain . ($components['path'] ?? ''); } return $url; From 72f241072c32f67deaf26b12b7e77b81e2738f4d Mon Sep 17 00:00:00 2001 From: Michael Engel Date: Mon, 4 Nov 2024 12:56:25 +0100 Subject: [PATCH 2/2] NTR - adjusts unit test --- tests/PHPUnit/Service/Routing/RoutingBuilderTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/PHPUnit/Service/Routing/RoutingBuilderTest.php b/tests/PHPUnit/Service/Routing/RoutingBuilderTest.php index 4290ea003..323403537 100644 --- a/tests/PHPUnit/Service/Routing/RoutingBuilderTest.php +++ b/tests/PHPUnit/Service/Routing/RoutingBuilderTest.php @@ -57,7 +57,7 @@ public function testWebhookUrlWithCustomDomain(): void # prepare our fake server data # assign a current domain to replace. # also configure our environment variable - $builder = $this->createBuilder('https://local.mollie.shop/notify/123', '123.eu.ngrok.io'); + $builder = $this->createBuilder('https://local.mollie.shop/notify/123', 'https://123.eu.ngrok.io'); $url = $builder->buildWebhookURL('-');