Scrubber.scrub() should handle exceptions in _parse_attachment.
There is a case in Scrubber._parse_attachment() which can return bytes instead of a string. Possibly this can be fixed with
--- a/django_mailman3/lib/scrub.py
+++ b/django_mailman3/lib/scrub.py
@@ -158,7 +158,7 @@ class Scrubber():
# able to decode the payload. If it is str, return it as it is,
# otherwise, try to decode it using the guessed charset.
if not isinstance(payload, str):
- decodedpayload = part.get_payload(decode=True)
+ decodedpayload = str(part.get_payload(decode=True))
else:
# It is also a str, just return it as it is.
decodedpayload = payload
Edited by Mark Sapiro