Skip to content

Commit

Permalink
Fixed #3299 malformed webhook URL
Browse files Browse the repository at this point in the history
  • Loading branch information
nfourtythree committed Oct 13, 2023
1 parent 0e1b814 commit 8b8920a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 6 additions & 1 deletion src/base/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 8b8920a

Please sign in to comment.