Skip to content

Commit

Permalink
Add Another InvalidHeaderDefect
Browse files Browse the repository at this point in the history
When an email header address field contains a period directly before the angle bracket, the default header policy raises an Attribute error, rather than adding a header defect.

GOVCERT-LU/eml_parser#41
  • Loading branch information
malvidin authored Feb 28, 2020
1 parent 02a4d57 commit c703e1c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Lib/email/_header_value_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1419,6 +1419,10 @@ def get_phrase(value):
phrase.defects.append(errors.ObsoleteHeaderDefect(
"period in 'phrase'"))
value = value[1:]
if value[0] in PHRASE_ENDS:
value = " " + value
phrase.defects.append(errors.InvalidHeaderDefect(
"trailing period in 'phrase' with no CFWS"))
else:
try:
token, value = get_word(value)
Expand Down

0 comments on commit c703e1c

Please sign in to comment.