mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Payloads with surrogates are passed to the set_payload() sincef97f25ef5dBackport ofb231bcd19efrom main.
This commit is contained in:
committed by
Sarah Boyce
parent
f075a19e85
commit
2e6ae1e96a
@@ -168,7 +168,8 @@ class SafeMIMEText(MIMEMixin, MIMEText):
|
||||
def set_payload(self, payload, charset=None):
|
||||
if charset == "utf-8" and not isinstance(charset, Charset.Charset):
|
||||
has_long_lines = any(
|
||||
len(line.encode()) > RFC5322_EMAIL_LINE_LENGTH_LIMIT
|
||||
len(line.encode(errors="surrogateescape"))
|
||||
> RFC5322_EMAIL_LINE_LENGTH_LIMIT
|
||||
for line in payload.splitlines()
|
||||
)
|
||||
# Quoted-Printable encoding has the side effect of shortening long
|
||||
|
||||
Reference in New Issue
Block a user