Skip to content

Commit 6a03920

Browse files
committed
Add workaround to contact resolve endpoint to deal with invalid phone numbers
1 parent f3dfc58 commit 6a03920

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

web/contact/contact.go

+4
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ func handleResolve(ctx context.Context, rt *runtime.Runtime, r *http.Request) (i
197197

198198
urn := request.URN.Normalize(string(oa.Env().DefaultCountry()))
199199

200+
// TODO rework normalization to be idempotent because an invalid number like +2621112222 normalizes to
201+
// 2621112222 (invalid) and then normalizes to +12621112222 (valid)
202+
urn = urn.Normalize(string(oa.Env().DefaultCountry()))
203+
200204
if err := urn.Validate(); err != nil {
201205
return errors.Wrapf(err, "URN failed validation"), http.StatusBadRequest, nil
202206
}

0 commit comments

Comments
 (0)