diff options
| author | Mike Edmunds <medmunds@gmail.com> | 2025-06-18 20:34:34 -0700 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2025-06-26 08:54:01 +0200 |
| commit | 23529b662793cdf4725d5f8ff58f0df94b343365 (patch) | |
| tree | 4d7d62237ce8f57c64e7d7c9f77e89fec3cdb59a /docs/ref | |
| parent | 68a45d9a8078db642f0aca7ddab33af6df7ebeb3 (diff) | |
Fixed #36478 -- Fixed inconsistent mail attachment handling.
Fixed an inconsistency between EmailMessage.attach() and .attachments
when attaching bytes content with a text/* mimetype. The attach()
function decodes UTF-8 bytes if possible and otherwise changes the
mimetype to application/octet-stream to preserve the content's unknown
encoding (refs #27007). Providing equivalent content directly in
EmailMessage.attachments did not apply the same logic, leading
to an "AttributeError: 'bytes' object has no attribute 'encode'"
in SafeMIMEText.set_payload().
Updated EmailMessage._create_mime_attachment() to match attach()'s
handling for text/* mimetypes with bytes content. Updated test cases
to accurately cover behavior on both paths.
Diffstat (limited to 'docs/ref')
0 files changed, 0 insertions, 0 deletions
