Compare commits

...
Author SHA1 Message Date
stumpylog ce8b68900d Fix: preserve document fields during Gotenberg conversion
Gotenberg's LibreOffice route enables updateIndexes by default, which
refreshes dynamic fields (e.g. auto-dates) to the current date. Disable
it so field values are preserved as authored.
2026-07-21 08:05:51 -07:00
2 changed files with 12 additions and 0 deletions
+5
View File
@@ -423,6 +423,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.
@@ -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()