From e3d333cdb10cb7512a0c9d8aed6c377e878dd61d Mon Sep 17 00:00:00 2001 From: Nic Pottier Date: Wed, 3 Apr 2019 13:36:42 -0500 Subject: [PATCH 1/3] Increase possible tel length `cellbroadcastchannel50` is a tel URN we are seeing. --- urns/urns.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/urns/urns.go b/urns/urns.go index 1025bd1..64d4dc8 100644 --- a/urns/urns.go +++ b/urns/urns.go @@ -78,7 +78,7 @@ func IsValidScheme(scheme string) bool { } var nonTelCharsRegex = regexp.MustCompile(`[^0-9a-z]`) -var telRegex = regexp.MustCompile(`^\+?[a-zA-Z0-9]{3,16}$`) +var telRegex = regexp.MustCompile(`^\+?[a-zA-Z0-9]{3,64}$`) var twitterHandleRegex = regexp.MustCompile(`^[a-zA-Z0-9_]{1,15}$`) var emailRegex = regexp.MustCompile(`^[^\s@]+@[^\s@]+$`) var viberRegex = regexp.MustCompile(`^[a-zA-Z0-9_=/+]{1,24}$`) From af29c9623a7e6ca59f846e3b9733a39e8a6aa7aa Mon Sep 17 00:00:00 2001 From: Nic Pottier Date: Wed, 3 Apr 2019 13:37:59 -0500 Subject: [PATCH 2/3] Update urns_test.go update tests --- urns/urns_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/urns/urns_test.go b/urns/urns_test.go index 4c89fb9..0c9e9e6 100644 --- a/urns/urns_test.go +++ b/urns/urns_test.go @@ -207,11 +207,11 @@ func TestValidate(t *testing.T) { {"tel:+250123", ""}, {"tel:1337", ""}, {"tel:PRIZES", ""}, - + {"tel:cellbroadcastchannel50", ""}, + // invalid tel numbers {"tel:07883 83383", "invalid tel number"}, // can't have spaces {"tel:12", "invalid tel number"}, // too short - {"tel:12345678901234567", "invalid tel number"}, // too long // twitter handles {"twitter:jimmyjo", ""}, From ea5aae1ba5b533f6002e62998617cd26602cb1cd Mon Sep 17 00:00:00 2001 From: Nic Pottier Date: Wed, 3 Apr 2019 13:39:24 -0500 Subject: [PATCH 3/3] update test --- urns/urns_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/urns/urns_test.go b/urns/urns_test.go index 0c9e9e6..0d3a303 100644 --- a/urns/urns_test.go +++ b/urns/urns_test.go @@ -208,10 +208,10 @@ func TestValidate(t *testing.T) { {"tel:1337", ""}, {"tel:PRIZES", ""}, {"tel:cellbroadcastchannel50", ""}, - + // invalid tel numbers - {"tel:07883 83383", "invalid tel number"}, // can't have spaces - {"tel:12", "invalid tel number"}, // too short + {"tel:07883 83383", "invalid tel number"}, // can't have spaces + {"tel:12", "invalid tel number"}, // too short // twitter handles {"twitter:jimmyjo", ""}, @@ -302,7 +302,7 @@ func TestTelURNs(t *testing.T) { {"PRIZES", "RW", "tel:prizes", false}, {"PRIZES!", "RW", "tel:prizes", false}, {"1", "RW", "", true}, - {"123456789012345678901234567890", "RW", "", true}, + {"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "RW", "", true}, } for _, tc := range testCases {