On 1/31/25 17:38, Mark Sapiro wrote:

On 1/31/25 12:14, Schulz wrote:

----
these are the first lines of the .eml:

MIME-Version: 1.0
Date: Tue, 28 Jan 2025 19:31:15 +0000
Content-Type: multipart/mixed;
  boundary="6efe513a-b2f8-47e5-ace0-b3b6aa5a056c-1"
From: "J. Schulz" <j...@jslz.de>
Message-ID: <17def72e63ed443458a88ec892a17fe01b8a2...@jslz.de>
TLS-Required: No
Subject: empty, but another att
To: i...@freie-dorfschule.de

--6efe513a-b2f8-47e5-ace0-b3b6aa5a056c-1
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable


--6efe513a-b2f8-47e5-ace0-b3b6aa5a056c-1
Content-Type: application/pdf; name="someExample.pdf"
Content-Disposition: attachment; filename="someExample.pdf"
Content-Transfer-Encoding: base64

JVBERi0xLjcKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0
ZURlY29kZT4+CnN0cmVhbQp4nC2NTQvCMBiD7++vCHjz0L7t1q2DMXAfgoeBg4Ln4TpRULEU
9OdbRB4SCISEhcKb5C7E6zqfI9qxoxcYLFhbmMoIXRrYXAlbKARPpy0eNKSWPAa/PsN9jtEv
G83Of2Jdy7E79OCmafv/UCJcqHVkCmFRlsmzCm6B3CsohltrVqw545wNF0llSjZRNe5Gg6Pp
9zfhC14SKM4KZW5kc3RyZWFtCmVuZG9iagoKMyAwIG9iagoxNTMKZW5kb2JqCgo3IDAgb2Jq
Cjw8L0xlbmd0aCA4IDAgUi9GaWx0ZXIvRmxhdGVEZWNvZGUvTGVuZ3RoMSA5MDc2Pj4Kc3Ry
ZWFtCnic5Vh9dFPHlb/zniTLH1iSP4RtGd4zwh9gW7ItTIAa/LAtYbDBso1BAgJ6lmQkYkta
SbZj0haTJoGYzyaEtEnOhuajTQgJz5AcTEqBLbs9yTZp04/ddje00G6a3Z4mkO02Pd3TYO+d
0bP5aJKes2f/2yfPmzv3zr33N/feGWmcjA8GIQtGgQfJPyDH5s3K1APAWwAkxz+UFPsiGgfS
VwG4V/pi2weeOLPlDwCawwBpr27vH+n7k+ZkC0AWNm0sFJQD8rtQCWB6FW0sDiHjyRvHdTj+
AMfzQwPJe/+Fe00DkGPEsbk/6pdbtKMoz6mg4wH53lhCU8/jWMKxGJEHgu+9/


I see the issue. Mailman's content filtering sees this multipart message as having two parts, the first of which is empty, so it tries to recast the message as a single part message containing only the second part.

The problem is this code only works if the second part is a text/* part. Here it decodes the base64 encoded pdf and tries to recast it as unicode text which works for text/* parts with a declared charset, but not for non-text parts.

This patch is untested, but I think it will fix the issue.
```
--- a/src/mailman/handlers/mime_delete.py
+++ b/src/mailman/handlers/mime_delete.py
@@ -221,7 +221,7 @@ Replaced multipart/alternative part with first alternative.

 def reset_payload(msg, subpart):
# Reset payload of msg to contents of subpart, and fix up content headers
-    if subpart.is_multipart():
+    if subpart.is_multipart() or subpart.get_content_maintype() != 'text':
         msg.set_payload(subpart.get_payload())
     else:
         cset = subpart.get_content_charset() or 'us-ascii'
```

--
Mark Sapiro <m...@msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

_______________________________________________
Mailman-users mailing list -- mailman-users@mailman3.org
To unsubscribe send an email to mailman-users-le...@mailman3.org
https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
Archived at: 
https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/message/FIORYUBGUSVHHIN6CCXT6DY5F53DKKZN/

This message sent to arch...@mail-archive.com

Reply via email to