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

View File

@ -44,7 +44,11 @@ def assume_rfc3156(msg):
def assume_oldstyle(payload): def assume_oldstyle(payload):
yield MailTest("Found BEGIN PGP SIGNED MESSAGE: message treated as old style PGP email.") 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