Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
3 changes: 1 addition & 2 deletions Lib/email/_header_value_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1854,7 +1854,6 @@ def get_group_list(value):
token[:0] = [leader]
group_list.append(token)
return group_list, value

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think it is a good idea to remove existing empty line.

def get_group(value):
""" group = display-name ":" [group-list] ";" [CFWS]

Expand All @@ -1875,7 +1874,7 @@ def get_group(value):
if not value:
group.defects.append(errors.InvalidHeaderDefect(
"end of header in group"))
if value[0] != ';':
elif value[0] != ';':
raise errors.HeaderParseError(
"expected ';' at end of group but found {}".format(value))
group.append(ValueTerminal(';', 'group-terminator'))
Expand Down
14 changes: 14 additions & 0 deletions Lib/test/test_email/test__header_value_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2048,6 +2048,20 @@ def test_get_group_list_comment_only_invalid(self):
group_list.all_mailboxes)

# get_group
def test_get_group_empty_missing_semi(self):
group = self._test_get_x(parser.get_group,
'Monty Python:',
'Monty Python:;',
'Monty Python:;',
[errors.InvalidHeaderDefect,
errors.InvalidHeaderDefect],
'')
self.assertEqual(group.token_type, 'group')
self.assertEqual(group.display_name, 'Monty Python')
self.assertEqual(len(group.mailboxes), 0)
self.assertEqual(group.mailboxes,
group.all_mailboxes)


def test_get_group_empty(self):
group = self._test_get_x(parser.get_group,
Expand Down