diff --git a/src/documents/consumer.py b/src/documents/consumer.py index 65febc937..8fed01c30 100755 --- a/src/documents/consumer.py +++ b/src/documents/consumer.py @@ -208,10 +208,7 @@ class Consumer(LoggingMixin): created = file_info.created or date or timezone.make_aware( datetime.datetime.fromtimestamp(stats.st_mtime)) - if settings.PASSPHRASE: - storage_type = Document.STORAGE_TYPE_GPG - else: - storage_type = Document.STORAGE_TYPE_UNENCRYPTED + storage_type = Document.STORAGE_TYPE_UNENCRYPTED with open(self.path, "rb") as f: document = Document.objects.create( @@ -260,8 +257,4 @@ class Consumer(LoggingMixin): def _write(self, document, source, target): with open(source, "rb") as read_file: with open(target, "wb") as write_file: - if document.storage_type == Document.STORAGE_TYPE_UNENCRYPTED: - write_file.write(read_file.read()) - return - self.log("debug", "Encrypting") - write_file.write(GnuPG.encrypted(read_file)) + write_file.write(read_file.read()) diff --git a/src/documents/management/commands/document_importer.py b/src/documents/management/commands/document_importer.py index 208a0ef37..5f50f08f6 100644 --- a/src/documents/management/commands/document_importer.py +++ b/src/documents/management/commands/document_importer.py @@ -82,8 +82,6 @@ class Command(Renderable, BaseCommand): def _import_files_from_manifest(self): storage_type = Document.STORAGE_TYPE_UNENCRYPTED - if settings.PASSPHRASE: - storage_type = Document.STORAGE_TYPE_GPG for record in self.manifest: @@ -105,23 +103,8 @@ class Command(Renderable, BaseCommand): create_source_path_directory(document.source_path) - if settings.PASSPHRASE: - - with open(document_path, "rb") as unencrypted: - with open(document.source_path, "wb") as encrypted: - print("Encrypting {} and saving it to {}".format( - doc_file, document.source_path)) - encrypted.write(GnuPG.encrypted(unencrypted)) - - with open(thumbnail_path, "rb") as unencrypted: - with open(document.thumbnail_path, "wb") as encrypted: - print("Encrypting {} and saving it to {}".format( - thumb_file, document.thumbnail_path)) - encrypted.write(GnuPG.encrypted(unencrypted)) - - else: - print(f"Moving {document_path} to {document.source_path}") - shutil.copy(document_path, document.source_path) - shutil.copy(thumbnail_path, document.thumbnail_path) + print(f"Moving {document_path} to {document.source_path}") + shutil.copy(document_path, document.source_path) + shutil.copy(thumbnail_path, document.thumbnail_path) document.save()