-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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
Fixed #35378 -- Added maximum header length for long addresses. #18110
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -894,6 +894,21 @@ def test_dont_mangle_from_in_body(self): | |||||||||||||||||
) | ||||||||||||||||||
self.assertNotIn(b">From the future", email.message().as_bytes()) | ||||||||||||||||||
|
||||||||||||||||||
def test_long_address_folding(self): | ||||||||||||||||||
# Ticket #35378 | ||||||||||||||||||
# should encode long addresses with special characters using | ||||||||||||||||||
# 7bit Content-Transfer-Encoding | ||||||||||||||||||
msg = EmailMessage( | ||||||||||||||||||
"Subject", | ||||||||||||||||||
"Long address with special characters", | ||||||||||||||||||
"from@example.com", | ||||||||||||||||||
['"Người nhận a very very long, name" <to@example.com>'], | ||||||||||||||||||
) | ||||||||||||||||||
s = msg.message().as_bytes() | ||||||||||||||||||
self.assertIn(b"Content-Transfer-Encoding: 7bit", s) | ||||||||||||||||||
s = msg.message().as_string() | ||||||||||||||||||
self.assertIn("Content-Transfer-Encoding: 7bit", s) | ||||||||||||||||||
Comment on lines
+907
to
+910
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I reverted your changes from In your solution, after you set
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, a test update is required 👍 def test_long_address_folding(self):
msg = EmailMessage(
"Subject",
"Long address with special characters",
"from@example.com",
['"Người nhận a very very long, name" <to@example.com>'],
).message()
msg.policy = policy.default.clone(cte_type="7bit")
self.assertIn(
"=?utf-8?b?TmfGsOG7nWkgbmjhuq1uIGEgdmVyeSB2ZXJ5IGxvbmcs?= name <to@example.com>",
msg.as_bytes().decode("ascii")
) This would use the example from the discussion. This also fails and I am not sure adding
Allowing longer line length was discussed and discouraged in this comment.
In short, I think more investigation is needed 🤔 |
||||||||||||||||||
|
||||||||||||||||||
def test_dont_base64_encode(self): | ||||||||||||||||||
# Ticket #3472 | ||||||||||||||||||
# Shouldn't use Base64 encoding at all | ||||||||||||||||||
|
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.
We no longer add comments in the tests until its really important. So maybe these can be removed.