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

MPP-3839: Handle trailing newline in headers #4879

Merged
merged 1 commit into from
Jul 15, 2024

Conversation

jwhitlock
Copy link
Member

The Python email library does not expect newlines in header values. It rejects newlines with a ValueError, except when the newline is at the end of the value. A newline can be present in the incoming email due to encoding. This newline is injected into the forwarded email. The mail client interprets this as the start of the email, and stops header processing.

This PR strips any trailing newlines from the header value, fixing issue #4841.

How to test:

Copy link
Member

@groovecoder groovecoder left a comment

Choose a reason for hiding this comment

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

nice catch and good fix!

@@ -0,0 +1,17 @@
Date: Tue, 09 Jul 2024 20:02:30 +0200
Subject: An =?UTF-8?Q?encoded_newline=0A?=
Copy link
Member

Choose a reason for hiding this comment

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

praise: thank you for plumbing the depths of email content down to the character level!

@groovecoder
Copy link
Member

quibble: this fixes the GitHub issue 4841 not the MPP-4841 ticket.

@groovecoder groovecoder added this pull request to the merge queue Jul 15, 2024
Merged via the queue into main with commit dcf6242 Jul 15, 2024
30 checks passed
@groovecoder groovecoder deleted the handle-encoded-newline-mpp4841 branch July 15, 2024 19:24
@jwhitlock jwhitlock changed the title MPP-4841: Handle trailing newline in headers MPP-3839: Handle trailing newline in headers Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants