Message388738
On parsing an email where the display name in an address ends on a dot immediately followed by angle-addr, accessing the resulting mailbox display_name throws
/usr/lib/python3.9/email/_header_value_parser.py in value(self)
589 if self[0].token_type=='cfws' or self[0][0].token_type=='cfws':
590 pre = ' '
--> 591 if self[-1].token_type=='cfws' or self[-1][-1].token_type=='cfws':
592 post = ' '
593 return pre+quote_string(self.display_name)+post
AttributeError: 'str' object has no attribute 'token_type'
The problem is that self[-1] is the terminal DOT.
An example of the problematic header is:
From: foobar.<baz@spam> |
|
Date |
User |
Action |
Args |
2021-03-15 13:11:05 | elenril | set | recipients:
+ elenril, barry, r.david.murray |
2021-03-15 13:11:05 | elenril | set | messageid: <1615813865.05.0.348558302999.issue43501@roundup.psfhosted.org> |
2021-03-15 13:11:04 | elenril | link | issue43501 messages |
2021-03-15 13:11:04 | elenril | create | |
|