A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
GnuPG for archive file.
Jonas Winkler6f30ceea38ab
diff --git a/src/documents/consumer.py b/src/documents/consumer.pyindex d3653e9c6..b7601aaf7 100755--- a/src/documents/consumer.py+++ b/src/documents/consumer.py@@ -194,7 +194,7 @@ class Consumer(LoggingMixin):thumbnail, document.thumbnail_path)if archive_path and os.path.isfile(archive_path):- self._write(Document.STORAGE_TYPE_UNENCRYPTED,+ self._write(document.storage_type,archive_path, document.archive_path)# Delete the file only if it was successfully consumeddiff --git a/src/documents/models.py b/src/documents/models.pyindex 2644657a3..5a4c9a187 100755--- a/src/documents/models.py+++ b/src/documents/models.py@@ -227,6 +227,8 @@ class Document(models.Model):@propertydef archive_path(self):fname = "{:07}{}".format(self.pk, ".pdf")+ if self.storage_type == self.STORAGE_TYPE_GPG:+ fname += ".gpg"return os.path.join(settings.ARCHIVE_DIR,diff --git a/src/documents/views.py b/src/documents/views.pyindex 457fa9dc7..9484b48cc 100755--- a/src/documents/views.py+++ b/src/documents/views.py@@ -137,16 +137,17 @@ class DocumentViewSet(RetrieveModelMixin,def file_response(self, pk, request, disposition):doc = Document.objects.get(id=pk)- mime_type = doc.mime_type- filename = doc.file_nameif not self.original_requested(request) and os.path.isfile(doc.archive_path): # NOQA: E501file_handle = doc.archive_filefilename = doc.archive_file_namemime_type = 'application/pdf'- elif doc.storage_type == Document.STORAGE_TYPE_UNENCRYPTED:- file_handle = doc.source_fileelse:- file_handle = GnuPG.decrypted(doc.source_file)+ file_handle = doc.source_file+ filename = doc.file_name+ mime_type = doc.mime_type++ if doc.storage_type == Document.STORAGE_TYPE_GPG:+ file_handle = GnuPG.decrypted(file_handle)response = HttpResponse(file_handle, content_type=mime_type)response["Content-Disposition"] = '{}; filename="{}"'.format(