Skip to content

Commit

Permalink
Merge pull request #742 from nyaruka/fix-EX-urns
Browse files Browse the repository at this point in the history
Fix urns creation so we trigger normalization
  • Loading branch information
rowanseymour authored May 9, 2024
2 parents e7ae14e + 3fcb647 commit ba05f59
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions handlers/external/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ func (h *handler) receiveStopContact(ctx context.Context, channel courier.Channe
if channel.Schemes()[0] == urns.Phone.Prefix {
urn, err = urns.ParsePhone(form.From, channel.Country())
} else {
urn = urns.URN(channel.Schemes()[0] + ":" + form.From)
err = urn.Validate()
urn, err = urns.NewFromParts(channel.Schemes()[0], form.From, nil, "")
}
if err != nil {
return nil, handlers.WriteAndLogRequestError(ctx, h, channel, w, r, err)
Expand Down Expand Up @@ -205,8 +204,7 @@ func (h *handler) receiveMessage(ctx context.Context, channel courier.Channel, w
if channel.Schemes()[0] == urns.Phone.Prefix {
urn, err = urns.ParsePhone(from, channel.Country())
} else {
urn = urns.URN(channel.Schemes()[0] + ":" + from)
err = urn.Validate()
urn, err = urns.NewFromParts(channel.Schemes()[0], from, nil, "")
}
if err != nil {
return nil, handlers.WriteAndLogRequestError(ctx, h, channel, w, r, err)
Expand Down

0 comments on commit ba05f59

Please sign in to comment.