When encode is not possible, assume it's already bytes, so return it raw with a warning

This commit is contained in:
nemunaire 2021-09-29 21:38:38 +02:00
parent 8f7d6e79c5
commit a52c756159
1 changed files with 5 additions and 1 deletions

View File

@ -44,7 +44,11 @@ def assume_rfc3156(msg):
def assume_oldstyle(payload):
yield MailTest("Found BEGIN PGP SIGNED MESSAGE: message treated as old style PGP email.")
yield payload.encode()
try:
yield payload.encode()
except:
yield MailTest("Non-armored signed message discovered. Avoid using binary message over SMTP (see RFC2015 #2. PGP data formats).", 2)
yield payload