Visitar URL original
email: address list folding encodes list-separator comma · Issue #100884 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20230119202837/https://github.com/python/cpython/issues/100884
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

email: address list folding encodes list-separator comma #100884

Open
t-8ch opened this issue Jan 9, 2023 · 0 comments · May be fixed by #100885
Open

email: address list folding encodes list-separator comma #100884

t-8ch opened this issue Jan 9, 2023 · 0 comments · May be fixed by #100885
Labels
expert-email type-bug An unexpected behavior, bug, or error

Comments

@t-8ch
Copy link

t-8ch commented Jan 9, 2023 •

Bug report

When during address list folding a separating comma ends up on a folded line containing that is to be unicode-encoded than the separator itself is also unicode encoded. Instead the comma should still a plain comma.

This is rejected by some mail servers:

ZZZ: host YYY said:
    550 Invalid address in message header. Consult RFC2822. (in reply to end of
    DATA command)

Minimal example:

>>> import email
>>> m = email.message.EmailMessage()
>>> t = '01234567890123456789012345678901234567890123456789012345678901@example.org, ä <foo@example.org>'
>>> m['to'] = t
>>> m.as_string()
'to: 01234567890123456789012345678901234567890123456789012345678901@example.org\n =?utf-8?q?=2C?= =?utf-8?q?=C3=A4?= <foo@example.org>\n\n'

Your environment

  • CPython versions tested on: 3.10.9, latest main (e47b139)
  • Operating system and architecture: ArchLinux x86_64

Linked PRs

@t-8ch t-8ch added the type-bug An unexpected behavior, bug, or error label Jan 9, 2023
t-8ch added a commit to t-8ch/cpython that referenced this issue Jan 9, 2023
There already is already a predefined object with the correct
properties, use it.
t-8ch added a commit to t-8ch/cpython that referenced this issue Jan 9, 2023
…tors

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
t-8ch added a commit to t-8ch/cpython that referenced this issue Jan 9, 2023
…tors

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
mricon added a commit to mricon/b4 that referenced this issue Jan 9, 2023
This tests for the bug reported here:
python/cpython#100884

Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
expert-email type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants