Skip to content

Commit

Permalink
use url join path instead of fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-nicolas committed Sep 20, 2024
1 parent 8dde783 commit ef4b506
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"math/big"
"net/url"
"os"
"time"

Expand Down Expand Up @@ -116,7 +117,11 @@ func (p Plugin) createWebhooks(ctx context.Context, req models.CreateWebhooksReq

webhookURL := fmt.Sprintf("%s/api/payments/v3/connectors/webhooks/%s", stackPublicURL, req.ConnectorID)
for eventType, config := range webhookConfigs {
url := fmt.Sprintf("%s%s", webhookURL, config.urlPath)
url, err := url.JoinPath(webhookURL, config.urlPath)
if err != nil {
return err
}

if v, ok := activeHooks[eventType]; ok {
// Already created, continue

Expand All @@ -132,7 +137,7 @@ func (p Plugin) createWebhooks(ctx context.Context, req models.CreateWebhooksReq
}

// Otherwise, create it
err := p.client.CreateHook(ctx, eventType, url)
err = p.client.CreateHook(ctx, eventType, url)
if err != nil {
return err
}
Expand Down

0 comments on commit ef4b506

Please sign in to comment.