Skip to content

Commit 1499226

Browse files
committed
Check local portion of email for invalid dots
Addresses failures related to: json-schema-org/JSON-Schema-Test-Suite#405
1 parent 3b502ec commit 1499226

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/json_schemer/format.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ def valid_date_time?(data)
7070
end
7171

7272
def valid_email?(data)
73-
EMAIL_REGEX.match?(data)
73+
return false unless EMAIL_REGEX.match?(data)
74+
local, _domain = data.partition('@')
75+
!local.start_with?('.') && !local.end_with?('.') && !local.include?('..')
7476
end
7577

7678
def valid_hostname?(data)

0 commit comments

Comments
 (0)