Scrubber can return content in the body for some messages with no text/plain part.
For example, this message
message = b"""To: list@example.com
From: user@example.com
Subject: test
Content-Type: image/png;
x-unix-mode=0644;
name="Screen Shot 2019-12-11 at 4.02.58 pm.png"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
filename="Screen Shot 2019-12-11 at 4.02.58 pm.png"
MIME-Version: 1.0
This is some content.
\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x08x\x00\x00
"""
when converted and scrubbed with
msg = message_from_bytes(message, _class=EmailMessage, policy=default)
body, attach = Scrubber(msg).scrub()
returns
[(0, 'ScreenShot2019-12-11at4.02.58pm.png', 'image/png', None, b'This is some content.\n\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x08x\x00\x00\n')]
as attach which is correct, but also
'This is some content.\n\x89PNG\r\n\x1a\n\rIHDR\x08x\n'
as body which should be just '\n'