-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
Refs #22561 -- Measured email long lines on encoded content #7803
Conversation
@@ -219,7 +219,9 @@ def __setitem__(self, name, val): | |||
|
|||
def set_payload(self, payload, charset=None): | |||
if charset == 'utf-8': | |||
has_long_lines = any(len(l) > RFC5322_EMAIL_LINE_LENGTH_LIMIT for l in payload.splitlines()) | |||
has_long_lines = any( | |||
len(l.encode('utf-8')) > RFC5322_EMAIL_LINE_LENGTH_LIMIT for l in payload.splitlines() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for ....
could go on the next line to balance things out
@@ -779,7 +779,8 @@ def test_send_long_lines(self): | |||
Message body containing longer lines are converted to Quoted-Printable | |||
to avoid having to insert newlines, which could be hairy to do properly. | |||
""" | |||
email = EmailMessage('Subject', "Comment ça va? " * 100, 'from@example.com', ['to@example.com']) | |||
# The body length is < 998 (840) when unencoded, but > 998 when utf-8 encoded. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make the comment fit on one line: (no comma needed since what comes after isn't an independent clause)
# Unencoded body length is < 998 (840) but > 998 when utf-8 encoded.
@@ -779,7 +779,8 @@ def test_send_long_lines(self): | |||
Message body containing longer lines are converted to Quoted-Printable | |||
to avoid having to insert newlines, which could be hairy to do properly. | |||
""" | |||
email = EmailMessage('Subject', "Comment ça va? " * 100, 'from@example.com', ['to@example.com']) | |||
# The body length is < 998 (840) when unencoded, but > 998 when utf-8 encoded. | |||
email = EmailMessage('Subject', "В южных морях " * 60, 'from@example.com', ['to@example.com']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use single quotes for consistency.
Should it be backported to 1.10? |
I don't think it's a regression, neither a bug in a new feature. Just a better fixed bug... |
Thanks Pavel Pokrovskiy for the report and Tim Graham for the review.
Thanks Pavel Pokrovskiy for the report.