Skip to content

Commit e5e3b51

Browse files
leonidguadalupealecthomas
authored andcommitted
Change email regex match to fullmatch
This PR is about the current method used to conditionally match user and domain regex to email. currently, it's using match which wrongfully accepts entries if domain has special characters after .com it currently accepts, john@voluptuous.com> or john!@voluptuous.org!@($*! thus, we need to fullmatch the domain or user to avoid such entries and validate them properly.
1 parent 1720439 commit e5e3b51

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

voluptuous/validators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ def Email(v):
435435
raise EmailInvalid("Invalid email address")
436436
user_part, domain_part = v.rsplit('@', 1)
437437

438-
if not (USER_REGEX.match(user_part) and DOMAIN_REGEX.match(domain_part)):
438+
if not (USER_REGEX.fullmatch(user_part) and DOMAIN_REGEX.fullmatch(domain_part)):
439439
raise EmailInvalid("Invalid email address")
440440
return v
441441
except:

0 commit comments

Comments
 (0)