A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Fix: preserve document fields during Gotenberg conversion (#13271)
Trenton H33cd48a17f04
diff --git a/src/paperless/parsers/tika.py b/src/paperless/parsers/tika.pyindex 53082c8b4..0baca73a3 100644--- a/src/paperless/parsers/tika.py+++ b/src/paperless/parsers/tika.py@@ -421,6 +421,11 @@ class TikaDocumentParser:logger.info("Converting %s to PDF as %s", document_path, pdf_path)with self._gotenberg_client.libre_office.to_pdf() as route:+ # Preserve document fields as authored. updateIndexes (Gotenberg's+ # default) triggers a refresh() that rewrites dynamic fields like+ # auto-dates to the current date.+ route.update_indexes(update_indexes=False)+# Set the output format of the resulting PDF.# OutputTypeConfig reads the database-stored ApplicationConfiguration# first, then falls back to the PAPERLESS_OCR_OUTPUT_TYPE env var.diff --git a/src/paperless/tests/parsers/test_tika_parser.py b/src/paperless/tests/parsers/test_tika_parser.pyindex 560527934..50ee75ae0 100644--- a/src/paperless/tests/parsers/test_tika_parser.py+++ b/src/paperless/tests/parsers/test_tika_parser.py@@ -223,4 +223,11 @@ class TestTikaParser:assert form_field_found+ # Field updates must be disabled so LibreOffice preserves document+ # fields (e.g. auto-date fields) as authored rather than refreshing+ # them to the current date.+ assert any(+ b'name="updateIndexes"' in part and b"false" in part for part in parts+ )+httpx_mock.reset()