A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Fix: use temp dir for split / merge (#7105)
shamoonf3cf608caafa
diff --git a/src/documents/bulk_edit.py b/src/documents/bulk_edit.pyindex 7733a8d68..7f56a1207 100644--- a/src/documents/bulk_edit.py+++ b/src/documents/bulk_edit.py@@ -2,6 +2,7 @@ import hashlibimport itertoolsimport loggingimport os+import tempfilefrom typing import Optionalfrom celery import chain@@ -269,7 +270,7 @@ def merge(return "OK"filepath = os.path.join(- settings.SCRATCH_DIR,+ tempfile.mkdtemp(dir=settings.SCRATCH_DIR),f"{'_'.join([str(doc_id) for doc_id in doc_ids])[:100]}_merged.pdf",)merged_pdf.remove_unreferenced_resources()@@ -321,7 +322,7 @@ def split(doc_ids: list[int], pages: list[list[int]], delete_originals: bool = Ffor page in split_doc:dst.pages.append(pdf.pages[page - 1])filepath = os.path.join(- settings.SCRATCH_DIR,+ tempfile.mkdtemp(dir=settings.SCRATCH_DIR),f"{doc.id}_{split_doc[0]}-{split_doc[-1]}.pdf",)dst.remove_unreferenced_resources()