Handle case Content-Type and Mime-Version are missing in prepare_pgp_message

This commit is contained in:
Son NK 2020-11-01 18:06:28 +01:00
parent 53e57eee42
commit 593e81705b
1 changed files with 8 additions and 0 deletions

View File

@ -411,6 +411,14 @@ def prepare_pgp_message(orig_msg: Message, pgp_fingerprint: str, public_key: str
_MIME_HEADERS,
)
if clone_msg["Content-Type"] is None:
LOG.d("Content-Type missing")
clone_msg["Content-Type"] = "text/plain"
if clone_msg["Mime-Version"] is None:
LOG.d("Mime-Version missing")
clone_msg["Mime-Version"] = "1.0"
first = MIMEApplication(
_subtype="pgp-encrypted", _encoder=encoders.encode_7or8bit, _data=""
)