Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect new strict parsing of email.utils.getaddresses #4023

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Products/CMFPlone/PloneTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ def validateSingleNormalizedEmailAddress(self, address):
# Address contains two newlines (possible spammer relay attack)
return False

# address can be empty if getaddresses has parsing errors (returns [("", "")])
petschki marked this conversation as resolved.
Show resolved Hide resolved
if address == "":
return False

# sub is an empty string if the address is valid
sub = EMAIL_RE.sub("", address)
if sub == "":
Expand Down
1 change: 0 additions & 1 deletion Products/CMFPlone/tests/testPloneTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def testvalidateEmailAddresses(self):
validInputs = (
"[email protected]",
"[email protected],\n [email protected]",
"[email protected]\n [email protected]", # omitting comma is ok
"[email protected],\n [email protected]",
)
invalidInputs = (
Expand Down
2 changes: 2 additions & 0 deletions news/4020.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Update for strict parsing in `email.utils.getaddresses` newest versions.
[petschki]