diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c79a38f69..5f04b1e806 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,9 @@ ## Unreleased -- Fixed a bug where emails were not being ordered by name correctly. ([#3263](https://github.com/craftcms/commerce/issues/3263)) - Fixed an XSS vulnerability. +- Fixed a bug where emails were not being ordered by name correctly. ([#3263](https://github.com/craftcms/commerce/issues/3263)) +- Fixed a bug where a gateway’s webhook URL was malformed. ([#3299](https://github.com/craftcms/commerce/issues/3299)) ## 3.4.22.1 - 2023-06-03 diff --git a/src/base/Gateway.php b/src/base/Gateway.php index 7c8d6a03d0..1e778fa918 100644 --- a/src/base/Gateway.php +++ b/src/base/Gateway.php @@ -54,7 +54,12 @@ public function getWebhookUrl(array $params = []): string $url = UrlHelper::actionUrl('commerce/webhooks/process-webhook', $params); - return StringHelper::replace($url, Craft::$app->getConfig()->getGeneral()->cpTrigger . '/', ''); + // Remove the cpTrigger from the url if it's there. + if (Craft::$app->getConfig()->getGeneral()->cpTrigger) { + $url = StringHelper::replace($url, Craft::$app->getConfig()->getGeneral()->cpTrigger . '/', ''); + } + + return $url; } /**