Skip to content

Commit 704e8d1

Browse files
committed
Merge pull request #13 from yetanalytics/6_mailto_percent_signs
6 mailto percent signs
2 parents c0ad5ba + c4a7ac3 commit 704e8d1

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

spec/cljx/xapi_schema/schemata/json_spec.cljx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
(should-satisfy+ MailToIRI
8787
"mailto:milt@yetanalytics.com"
8888
:bad
89+
"mailto:user%@example.com"
8990
"milt@yetanalytics.com")))
9091

9192
(describe

spec/cljx/xapi_schema/schemata/regex_spec.cljx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
(it "matches valid mailto IRIs"
4040
(should (re-matches MailToIRIRegEx "mailto:milt@yetanalytics.com"))
4141
(should-not (re-matches MailToIRIRegEx "http://foo.com"))
42-
(should-not (re-matches MailToIRIRegEx "milt@yetanalytics.com"))))
42+
(should-not (re-matches MailToIRIRegEx "milt@yetanalytics.com"))
43+
(should-not (re-matches MailToIRIRegEx "mi%lt@yetanalytics.com"))
44+
(should (re-matches MailToIRIRegEx "mailto:mi%0Alt@yetanalytics.com"))))
4345

4446
(describe "UuidRegEx"
4547
(it "matches valid 4.0 UUIDs"

src/cljx/xapi_schema/schemata/regex.cljx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#+cljs #"^((([A-Za-z]{3,9}:(?://)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-\[\]\:\+]+)((?:/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w\-]*))?)$")
1717

1818
(def MailToIRIRegEx
19-
#"mailto:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?")
19+
#"mailto:(?:[a-zA-Z0-9!#$&'*+/=?^_`{|}~-]|%[0-9a-fA-F]{2})+(?:\.(?:[a-zA-Z0-9!#$&'*+/=?^_`{|}~-]|%[0-9a-fA-F]{2})+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?")
2020

2121
(def UuidRegEx
2222
#"[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-4[0-9A-Za-z]{3}-[89ABab][0-9A-Za-z]{3}-[0-9A-Za-z]{12}")

0 commit comments

Comments
 (0)