summaryrefslogtreecommitdiffstats
path: root/Lib/email/_header_value_parser.py
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas@t-8ch.de>2024-02-17 10:13:46 (GMT)
committerGitHub <noreply@github.com>2024-02-17 10:13:46 (GMT)
commit09fab93c3d857496c0bd162797fab816c311ee48 (patch)
tree3285ab2965952b5685bb70c72525fcef44807a05 /Lib/email/_header_value_parser.py
parent465db27cb983084e718a1fd9519b2726c96935cb (diff)
downloadcpython-09fab93c3d857496c0bd162797fab816c311ee48.zip
cpython-09fab93c3d857496c0bd162797fab816c311ee48.tar.gz
cpython-09fab93c3d857496c0bd162797fab816c311ee48.tar.bz2
gh-100884: email/_header_value_parser: don't encode list separators (GH-100885)
ListSeparator should not be encoded. This could happen when a long line pushes its separator to the next line, which would have been encoded.
Diffstat (limited to 'Lib/email/_header_value_parser.py')
-rw-r--r--Lib/email/_header_value_parser.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py
index 5b653f6..e4a342d 100644
--- a/Lib/email/_header_value_parser.py
+++ b/Lib/email/_header_value_parser.py
@@ -949,6 +949,7 @@ class _InvalidEwError(errors.HeaderParseError):
# up other parse trees. Maybe should have tests for that, too.
DOT = ValueTerminal('.', 'dot')
ListSeparator = ValueTerminal(',', 'list-separator')
+ListSeparator.as_ew_allowed = False
RouteComponentMarker = ValueTerminal('@', 'route-component-marker')
#
@@ -2022,7 +2023,7 @@ def get_address_list(value):
address_list.defects.append(errors.InvalidHeaderDefect(
"invalid address in address-list"))
if value: # Must be a , at this point.
- address_list.append(ValueTerminal(',', 'list-separator'))
+ address_list.append(ListSeparator)
value = value[1:]
return address_list, value