If the selected OCR mode is not a valid choice, warn and default to auto instead

This commit is contained in:
Trenton Holmes committed 2026-04-05 13:38:25 -07:00
1 parent 4138319832
commit 7f01b3a6f9
1 file changed
+4
+4
View File
@@ -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"},