mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-09-16 06:38:00 +00:00
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.
This commit is contained in:
@@ -423,6 +423,11 @@ class TikaDocumentParser:
|
|||||||
logger.info("Converting %s to PDF as %s", document_path, pdf_path)
|
logger.info("Converting %s to PDF as %s", document_path, pdf_path)
|
||||||
|
|
||||||
with self._gotenberg_client.libre_office.to_pdf() as route:
|
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.
|
# Set the output format of the resulting PDF.
|
||||||
# OutputTypeConfig reads the database-stored ApplicationConfiguration
|
# OutputTypeConfig reads the database-stored ApplicationConfiguration
|
||||||
# first, then falls back to the PAPERLESS_OCR_OUTPUT_TYPE env var.
|
# first, then falls back to the PAPERLESS_OCR_OUTPUT_TYPE env var.
|
||||||
|
|||||||
@@ -223,4 +223,11 @@ class TestTikaParser:
|
|||||||
|
|
||||||
assert form_field_found
|
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()
|
httpx_mock.reset()
|
||||||
|
|||||||
Reference in New Issue
Block a user