Rudimentary support for not re-encrypting already encrypted messages
This commit is contained in:
parent
e7bd005430
commit
d03492a183
1 changed files with 2 additions and 0 deletions
|
@ -44,6 +44,8 @@ def encrypt_payload( payload, gpg_to_cmdline ):
|
|||
gpg = GnuPG.GPGEncryptor( cfg['gpg']['keyhome'], gpg_to_cmdline )
|
||||
raw_payload = payload.get_payload(decode=True)
|
||||
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