Skip to content
Closed
2 changes: 1 addition & 1 deletion Lib/email/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def get_payload(self, i=None, decode=False):
raise TypeError('Expected list, got %s' % type(self._payload))
payload = self._payload
# cte might be a Header, so for now stringify it.
cte = str(self.get('content-transfer-encoding', '')).lower()
cte = str(self.get('content-transfer-encoding', '')).lower().strip(' ')
# payload may be bytes here.
if not decode:
if isinstance(payload, str) and utils._has_surrogates(payload):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix :meth:`email.Message.get_payload` couldn't parse headers
with extra spaces. Patch by RUANG.
Loading