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
13 changed files with 20 additions and 65 deletions
+1 -3
View File
@@ -37,9 +37,7 @@ WORKDIR /usr/src/s6
# https://github.com/just-containers/s6-overlay#customizing-s6-overlay-behaviour
ENV \
S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=60000 \
S6_KILL_GRACETIME=30000 \
S6_SERVICES_GRACETIME=30000 \
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \
S6_VERBOSITY=1 \
PATH=/command:$PATH
@@ -1,16 +0,0 @@
#!/command/with-contenv /usr/bin/bash
# shellcheck shell=bash
if [[ -n "${PAPERLESS_CONSUMER_DISABLE}" ]]; then
if [[ $1 -eq 0 ]]; then
echo "[svc-consumer] Consumer is disabled, service did not run"
else
echo "[svc-consumer] Consumer is disabled, but service exited with error (exit code: $1, signal: $2)" >&2
fi
else
if [[ $1 -eq 0 ]]; then
echo "[svc-consumer] Service stopped cleanly (exit code: $1, signal: $2)"
else
echo "[svc-consumer] Service exited with error (exit code: $1, signal: $2)" >&2
fi
fi
@@ -1,16 +0,0 @@
#!/command/with-contenv /usr/bin/bash
# shellcheck shell=bash
if [[ -z "${PAPERLESS_ENABLE_FLOWER}" ]]; then
if [[ $1 -eq 0 ]]; then
echo "[svc-flower] Flower is disabled, service did not run"
else
echo "[svc-flower] Flower is disabled, but service exited with error (exit code: $1, signal: $2)" >&2
fi
else
if [[ $1 -eq 0 ]]; then
echo "[svc-flower] Service stopped cleanly (exit code: $1, signal: $2)"
else
echo "[svc-flower] Service exited with error (exit code: $1, signal: $2)" >&2
fi
fi
@@ -6,6 +6,9 @@ declare -r log_prefix="[svc-flower]"
echo "${log_prefix} Checking if we should start flower..."
if [[ -n "${PAPERLESS_ENABLE_FLOWER}" ]]; then
# Small delay to allow celery to be up first
echo "${log_prefix} Starting flower in 5s"
sleep 5
cd ${PAPERLESS_SRC_DIR}
if [[ -n "${USER_IS_NON_ROOT}" ]]; then
@@ -1,8 +0,0 @@
#!/command/with-contenv /usr/bin/bash
# shellcheck shell=bash
if [[ $1 -eq 0 ]]; then
echo "[svc-scheduler] Service stopped cleanly (exit code: $1, signal: $2)"
else
echo "[svc-scheduler] Service exited with error (exit code: $1, signal: $2)" >&2
fi
@@ -1,8 +0,0 @@
#!/command/with-contenv /usr/bin/bash
# shellcheck shell=bash
if [[ $1 -eq 0 ]]; then
echo "[svc-webserver] Service stopped cleanly (exit code: $1, signal: $2)"
else
echo "[svc-webserver] Service exited with error (exit code: $1, signal: $2)" >&2
fi
@@ -14,7 +14,7 @@ if [[ -n "${PAPERLESS_FORCE_SCRIPT_NAME}" ]]; then
fi
if [[ -n "${USER_IS_NON_ROOT}" ]]; then
exec s6-notifyoncheck -d -w 1000 -- curl -sf "http://localhost:${GRANIAN_PORT}/" -- granian --interface asginl --ws --loop uvloop "paperless.asgi:application"
exec granian --interface asginl --ws --loop uvloop "paperless.asgi:application"
else
exec s6-notifyoncheck -d -w 1000 -- curl -sf "http://localhost:${GRANIAN_PORT}/" -- s6-setuidgid paperless granian --interface asginl --ws --loop uvloop "paperless.asgi:application"
exec s6-setuidgid paperless granian --interface asginl --ws --loop uvloop "paperless.asgi:application"
fi
@@ -1,8 +0,0 @@
#!/command/with-contenv /usr/bin/bash
# shellcheck shell=bash
if [[ $1 -eq 0 ]]; then
echo "[svc-worker] Service stopped cleanly (exit code: $1, signal: $2)"
else
echo "[svc-worker] Service exited with error (exit code: $1, signal: $2)" >&2
fi
@@ -1 +0,0 @@
3
@@ -4,7 +4,7 @@
cd ${PAPERLESS_SRC_DIR}
if [[ -n "${USER_IS_NON_ROOT}" ]]; then
exec s6-notifyoncheck -d -w 1000 -- sh -c 'celery --app paperless inspect ping --timeout 1' -- /usr/local/bin/celery --app paperless worker --loglevel INFO --without-mingle --without-gossip
exec /usr/local/bin/celery --app paperless worker --loglevel INFO --without-mingle --without-gossip
else
exec s6-notifyoncheck -d -w 1000 -- sh -c 'celery --app paperless inspect ping --timeout 1' -- s6-setuidgid paperless /usr/local/bin/celery --app paperless worker --loglevel INFO --without-mingle --without-gossip
exec s6-setuidgid paperless /usr/local/bin/celery --app paperless worker --loglevel INFO --without-mingle --without-gossip
fi
+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()