Sometimes gpgmail fails, so let the legacy code handle the message
This commit is contained in:
parent
d13d93c39c
commit
8f7d6e79c5
5
check.py
5
check.py
@ -40,7 +40,7 @@ def gen_checks(gpgmail, submissions_dir, check_content=False, check_submission_h
|
|||||||
else:
|
else:
|
||||||
yield signcheck
|
yield signcheck
|
||||||
|
|
||||||
if not gpgmail.valid:
|
if gpgmail is None or not gpgmail.valid:
|
||||||
yield (envelope.check, [GNUPG_DIRECTORY, not skip_public_key, BETA])
|
yield (envelope.check, [GNUPG_DIRECTORY, not skip_public_key, BETA])
|
||||||
yield (signature.check, [GNUPG_DIRECTORY])
|
yield (signature.check, [GNUPG_DIRECTORY])
|
||||||
else:
|
else:
|
||||||
@ -188,7 +188,10 @@ def readmail(fp):
|
|||||||
import gnupg_mail
|
import gnupg_mail
|
||||||
|
|
||||||
theEMail = fp.read()
|
theEMail = fp.read()
|
||||||
|
try:
|
||||||
gpgmail = gnupg_mail.Message(theEMail.decode(), settings=gnupg_mail.Settings(log_level='debug',require_signed=True), gpg=gnupg.GPG(gnupghome=GNUPG_DIRECTORY))
|
gpgmail = gnupg_mail.Message(theEMail.decode(), settings=gnupg_mail.Settings(log_level='debug',require_signed=True), gpg=gnupg.GPG(gnupghome=GNUPG_DIRECTORY))
|
||||||
|
except:
|
||||||
|
gpgmail = None
|
||||||
|
|
||||||
cnt = email.message_from_bytes(theEMail, policy=email.policy.default)
|
cnt = email.message_from_bytes(theEMail, policy=email.policy.default)
|
||||||
frm = cnt.get("From") or "someone"
|
frm = cnt.get("From") or "someone"
|
||||||
|
Reference in New Issue
Block a user