This is an automated email from the ASF dual-hosted git repository. kentontaylor pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/allura.git
commit d40226287d844976f183d93296afca77958679b8 Author: Dave Brondsema <dbronds...@slashdotmedia.com> AuthorDate: Thu Jan 4 14:52:17 2024 -0500 [#8533] remove old quoted-printable line length approach --- Allura/allura/lib/mail_util.py | 16 +--------------- Allura/allura/tests/test_tasks.py | 9 +++++---- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/Allura/allura/lib/mail_util.py b/Allura/allura/lib/mail_util.py index 5e7907d65..24f1eb8c6 100644 --- a/Allura/allura/lib/mail_util.py +++ b/Allura/allura/lib/mail_util.py @@ -199,21 +199,7 @@ def encode_email_part(content, content_type): encoded_content = content.encode('utf-8') encoding = 'utf-8' - for line in encoded_content.splitlines(): - if len(line) > MAX_MAIL_LINE_OCTETS: - # switch to Quoted-Printable encoding to avoid too-long lines - # we could always Quoted-Printabl, but it makes the output a little messier and less human-readable - # the particular order of all these operations seems to be very important for everything to end up right - msg = MIMEText('', content_type, policy=email_policy) - msg.replace_header('content-transfer-encoding', 'quoted-printable') - cs = email.charset.Charset('utf-8') - cs.header_encoding = email.charset.QP - cs.body_encoding = email.charset.QP - payload = cs.body_encode(content.encode('utf-8')) - msg.set_payload(payload, 'utf-8') - return msg - else: - return MIMEText(encoded_content, content_type, encoding, policy=email_policy) + return MIMEText(encoded_content, content_type, encoding, policy=email_policy) def make_multipart_message(*parts): diff --git a/Allura/allura/tests/test_tasks.py b/Allura/allura/tests/test_tasks.py index 9e00970b6..8ecbeeb05 100644 --- a/Allura/allura/tests/test_tasks.py +++ b/Allura/allura/tests/test_tasks.py @@ -480,12 +480,13 @@ class TestMailTasks(unittest.TestCase): for line in body: assert len(line) <= MAX_MAIL_LINE_OCTETS + bodystr = ''.join(body) # plain text - assert '012345678901234567890123456789012345678901234567890123456789012345678901234=' in body - assert '=D0=93=D1=80=D0=BE=D0=BC=D0=B0=D0=B4=D1=8B =D1=81=D1=82=D1=80=D0=BE =D0=93=' in body + assert b64encode(b'012345678901234567890123').decode('utf8') in bodystr + assert b64encode('Громады стро '.encode('utf8')).decode('utf8') in bodystr # html - assert '<div class=3D"markdown_content"><p>0123456789012345678901234567890123456789=' in body - assert '<p>=D0=93=D1=80=D0=BE=D0=BC=D0=B0=D0=B4=D1=8B =D1=81=D1=82=D1=80=D0=BE =D0=' in body + assert b64encode(b'<div class="markdown_content"><p>012345678901234567890123').decode('utf8') in bodystr + assert b64encode('<p>Громады стро '.encode('utf8')).decode('utf8') in bodystr @td.with_wiki def test_receive_email_ok(self):