From 7f01b3a6f953262003f487ed7bf86dd5b000a5d2 Mon Sep 17 00:00:00 2001 From: Trenton Holmes <797416+stumpylog@users.noreply.github.com> Date: Sun, 5 Apr 2026 13:38:13 -0700 Subject: [PATCH] If the selected OCR mode is not a valid choice, warn and default to auto instead --- src/paperless/settings/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/paperless/settings/__init__.py b/src/paperless/settings/__init__.py index 772c51801..024b6e5fe 100644 --- a/src/paperless/settings/__init__.py +++ b/src/paperless/settings/__init__.py @@ -889,6 +889,10 @@ OCR_LANGUAGE = os.getenv("PAPERLESS_OCR_LANGUAGE", "eng") # OCRmyPDF --output-type options are available. OCR_OUTPUT_TYPE = os.getenv("PAPERLESS_OCR_OUTPUT_TYPE", "pdfa") +_ocr_mode_raw = os.environ.get("PAPERLESS_OCR_MODE", "") +if _ocr_mode_raw in ("skip", "skip_noarchive"): + os.environ["PAPERLESS_OCR_MODE"] = "auto" + OCR_MODE = get_choice_from_env( "PAPERLESS_OCR_MODE", {"auto", "force", "redo", "off"},