src/paperless/db.py: If encryption is disabled, just directly read the file contents

This commit is contained in:
Mike Cronce authored and Daniel Quinn committed 2018-05-28 12:58:28 +01:00
1 parent 8783c2af88
commit 3b6a3219f5
1 file changed
+4
+4
View File
@@ -12,11 +12,15 @@ class GnuPG(object):
@classmethod
def decrypted(cls, file_handle):
if(not settings.ENABLE_ENCRYPTION):
return file_handle.read()
return cls.gpg.decrypt_file(
file_handle, passphrase=settings.PASSPHRASE).data
@classmethod
def encrypted(cls, file_handle):
if(not settings.ENABLE_ENCRYPTION):
return file_handle.read()
return cls.gpg.encrypt_file(
file_handle,
recipients=None,