summaryrefslogtreecommitdiffstats
path: root/Lib/email/message.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-04-17 16:59:35 (GMT)
committerGitHub <noreply@github.com>2024-04-17 16:59:35 (GMT)
commitfda8cd1fd38a12e17b1db1775d54ff0fa4d886b8 (patch)
treeba0127c7f89e042d76be05558b193aae3db7959f /Lib/email/message.py
parente95a535ea2915060759db66ae9e228a19f134125 (diff)
downloadcpython-fda8cd1fd38a12e17b1db1775d54ff0fa4d886b8.zip
cpython-fda8cd1fd38a12e17b1db1775d54ff0fa4d886b8.tar.gz
cpython-fda8cd1fd38a12e17b1db1775d54ff0fa4d886b8.tar.bz2
[3.12] gh-80361: Fix TypeError in email.Message.get_payload() (GH-117994) (GH-117998)
It was raised when the charset is rfc2231 encoded, e.g.: Content-Type: text/plain; charset*=ansi-x3.4-1968''utf-8 (cherry picked from commit deaecb88fa5da68cbffca413c63af95fd99578dd) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib/email/message.py')
-rw-r--r--Lib/email/message.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/email/message.py b/Lib/email/message.py
index a14cca5..46bb8c2 100644
--- a/Lib/email/message.py
+++ b/Lib/email/message.py
@@ -294,7 +294,7 @@ class Message:
try:
bpayload = payload.encode('ascii', 'surrogateescape')
try:
- payload = bpayload.decode(self.get_param('charset', 'ascii'), 'replace')
+ payload = bpayload.decode(self.get_content_charset('ascii'), 'replace')
except LookupError:
payload = bpayload.decode('ascii', 'replace')
except UnicodeEncodeError: