mirror of
https://github.com/django/django.git
synced 2025-01-03 06:55:47 +00:00
Refs #34900 -- Fixed SafeMIMEText.set_payload() crash on Python 3.13.
Payloads with surrogates are passed to the set_payload() since
f97f25ef5d
This commit is contained in:
parent
36a000858b
commit
b231bcd19e
@ -168,7 +168,8 @@ class SafeMIMEText(MIMEMixin, MIMEText):
|
|||||||
def set_payload(self, payload, charset=None):
|
def set_payload(self, payload, charset=None):
|
||||||
if charset == "utf-8" and not isinstance(charset, Charset.Charset):
|
if charset == "utf-8" and not isinstance(charset, Charset.Charset):
|
||||||
has_long_lines = any(
|
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()
|
for line in payload.splitlines()
|
||||||
)
|
)
|
||||||
# Quoted-Printable encoding has the side effect of shortening long
|
# Quoted-Printable encoding has the side effect of shortening long
|
||||||
|
Loading…
Reference in New Issue
Block a user