Skip to content

Commit 98ab61d

Browse files
committed
pythonGH-100884: email/_header_value_parser: don't encode list separators
ListSeparator should not be encoded. This could happen when a long line pushes its separator to the next line, which would have been encoded. Fixes python#100884
1 parent b1f41b8 commit 98ab61d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Lib/email/_header_value_parser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,7 @@ class _InvalidEwError(errors.HeaderParseError):
949949
# up other parse trees. Maybe should have tests for that, too.
950950
DOT = ValueTerminal('.', 'dot')
951951
ListSeparator = ValueTerminal(',', 'list-separator')
952+
ListSeparator.as_ew_allowed = False
952953
RouteComponentMarker = ValueTerminal('@', 'route-component-marker')
953954

954955
#

Lib/test/test_email/test__header_value_parser.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2946,6 +2946,11 @@ def test_address_list_with_unicode_names_in_quotes(self):
29462946
'=?utf-8?q?H=C3=BCbsch?= Kaktus <[email protected]>,\n'
29472947
' =?utf-8?q?bei=C3=9Ft_bei=C3=9Ft?= <[email protected]>\n')
29482948

2949+
def test_address_list_with_list_separator_after_fold(self):
2950+
to = '0123456789' * 8 + '@foo, ä <foo@bar>'
2951+
self._test(parser.get_address_list(to)[0],
2952+
'0123456789' * 8 + '@foo,\n =?utf-8?q?=C3=A4?= <foo@bar>\n')
2953+
29492954
# XXX Need tests with comments on various sides of a unicode token,
29502955
# and with unicode tokens in the comments. Spaces inside the quotes
29512956
# currently don't do the right thing.

0 commit comments

Comments
 (0)