From bcbea404d9b5c04f9cb219b80917410988807356 Mon Sep 17 00:00:00 2001 From: Robin Windey Date: Fri, 22 May 2026 14:23:17 +0000 Subject: [PATCH 1/3] chore: Update python deps --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 4b57be2..5693f7d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -nc-py-api[app]==0.23.1 -ocrmypdf==16.13.0 +nc-py-api[app]==0.30.1 +ocrmypdf==17.4.2 python-multipart==0.0.20 \ No newline at end of file From caeca9430314b7584f0165399cb8af67c2b77484 Mon Sep 17 00:00:00 2001 From: Robin Windey Date: Fri, 22 May 2026 14:38:32 +0000 Subject: [PATCH 2/3] fix: Update expected error message for ocrmypdf 17.x compatibility The PriorOcrFoundError message changed in ocrmypdf 17.x: - Before: 'page already has text! - aborting (use --force-ocr to force OCR; see also help for the arguments --skip-text and --redo-ocr' - After: 'page already has text! - aborting (use --force-ocr or --mode force to force OCR; see also help for --skip-text, --redo-ocr, and --mode)' --- test/test_app.py | 2 +- workflow_ocr_backend/app.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_app.py b/test/test_app.py index 072a938..63f92fb 100644 --- a/test/test_app.py +++ b/test/test_app.py @@ -58,7 +58,7 @@ def test_process_ocr_error_already_processed_file(): assert response.status_code == 500 response_json = response.json() assert "message" in response_json - assert response_json["message"] == "page already has text! - aborting (use --force-ocr to force OCR; see also help for the arguments --skip-text and --redo-ocr (PriorOcrFoundError)" + assert response_json["message"] == "page already has text! - aborting (use --force-ocr or --mode force to force OCR; see also help for --skip-text, --redo-ocr, and --mode) (PriorOcrFoundError)" assert "ocrMyPdfExitCode" in response_json assert response_json["ocrMyPdfExitCode"] == 6 diff --git a/workflow_ocr_backend/app.py b/workflow_ocr_backend/app.py index ac5321a..1e30bbc 100644 --- a/workflow_ocr_backend/app.py +++ b/workflow_ocr_backend/app.py @@ -24,7 +24,7 @@ async def lifespan(app: FastAPI): logger = logging.getLogger('uvicorn.error') # Use same logging as uvicorn -def enabled_handler(enabled: bool, _: NextcloudApp | AsyncNextcloudApp) -> str: +async def enabled_handler(enabled: bool, _: AsyncNextcloudApp) -> str: # Nothing to do currently ... logger.debug(f"App enabled: {enabled}") return "" From d0e53680cd2138ca76081423d05bcee123e32bb7 Mon Sep 17 00:00:00 2001 From: Robin Windey Date: Fri, 22 May 2026 14:44:29 +0000 Subject: [PATCH 3/3] fix: Normalize hyphenated CLI params to underscores for ocrmypdf 17.x ocrmypdf 17.x no longer accepts hyphenated kwargs like 'image-dpi'; only the underscore form 'image_dpi' is accepted by the Python API. Replace hyphens with underscores in _split_parameters to maintain compatibility. --- workflow_ocr_backend/ocrservice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow_ocr_backend/ocrservice.py b/workflow_ocr_backend/ocrservice.py index 448ea64..dfe855f 100644 --- a/workflow_ocr_backend/ocrservice.py +++ b/workflow_ocr_backend/ocrservice.py @@ -57,7 +57,7 @@ def _split_parameters(self, ocrmypdf_parameters: str) -> dict[str, str | bool | if not param: continue splitted_param = [p.strip() for p in param.split(" ")] - key = splitted_param[0] + key = splitted_param[0].replace("-", "_") length = len(splitted_param) if length >= 2: value = splitted_param[1]