diff --git a/check.py b/check.py index 13f09fd..c96e48f 100755 --- a/check.py +++ b/check.py @@ -40,7 +40,7 @@ def gen_checks(gpgmail, submissions_dir, check_content=False, check_submission_h else: 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 (signature.check, [GNUPG_DIRECTORY]) else: @@ -188,7 +188,10 @@ def readmail(fp): import gnupg_mail theEMail = fp.read() - gpgmail = gnupg_mail.Message(theEMail.decode(), settings=gnupg_mail.Settings(log_level='debug',require_signed=True), gpg=gnupg.GPG(gnupghome=GNUPG_DIRECTORY)) + try: + 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) frm = cnt.get("From") or "someone"