Rudimentary support for not re-encrypting already encrypted messages
This commit is contained in:
parent
d468766f8a
commit
fbda6a6e72
1 changed files with 2 additions and 0 deletions
|
@ -50,6 +50,8 @@ def encrypt_payload( payload, gpg_to_cmdline ):
|
|||
return payload
|
||||
gpg = GnuPG.GPGEncryptor( cfg['gpg']['keyhome'], gpg_to_cmdline, payload.get_content_charset() )
|
||||
gpg.update( raw_payload )
|
||||
if "-----BEGIN PGP MESSAGE-----" in raw_payload and "-----END PGP MESSAGE-----" in raw_payload:
|
||||
return payload
|
||||
payload.set_payload( gpg.encrypt() )
|
||||
if payload['Content-Disposition']:
|
||||
payload.replace_header( 'Content-Disposition', re.sub(r'filename="([^"]+)"', r'filename="\1.pgp"', payload['Content-Disposition']) )
|
||||
|
|
Loading…
Reference in a new issue