Repository navigation
Gracefully handle already done ocr - #308
Conversation
Throw OcrResultEmptyException if OCRmyPDF returns exit code 6 (ExitCode.already_done_ocr). Fix of #293 Signed-off-by: XueSheng-GIT <Michael.Frase@gmx.de>
|
Thanks for this PR @XueSheng-GIT 👍 At a first glance, the code LGTM. I need to check why some of the tests are failing but I also encountered this
I don't think it was intended that I didn't add it to the "Remote"-implementation. As far as I remember this check was to ensure that we never overwrite the original PDF with an empty payload. Also this was slightly adjusted to cover #232. I would suggest leave it there for now, I'm working on a common base class for "Local" and "Remote" anyways so I will move it there
Would be brilliant if you could provide 2 additional test cases. Let me know if you need help with the implementation of the PHPUnits |
|
@R0Wi |
|
I can take a look into the tests, no problem. If you need a quick NC dev setup, I can recommend using the Nextcloud Devcontainer or directly run the IDE within Github Codespaces. |
15b9d64 to
9ad521e
Compare
@XueSheng-GIT you were right, I needed to update the OCP composer package to reflect the latest NC code changes. Otherwise it ran into conflicts with the function signature. I added some tests and I'm trying to finalize those soon. |
b688064 to
71ed5cf
Compare
71ed5cf to
c2a81c4
Compare
|
|
The backport to To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-stable31 stable31
# Navigate to the new working tree
cd .worktrees/backport-stable31
# Create a new branch
git switch --create backport-308-to-stable31
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick ---mainline 1 10332e96f984fa643743daa9ea50ecbac28289af
# Push it to GitHub
git push --set-upstream origin backport-308-to-stable31
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-stable31Then, create a pull request where the |
* Gracefully handle already done ocr Throw OcrResultEmptyException if OCRmyPDF returns exit code 6 (ExitCode.already_done_ocr). Fix of #293 Signed-off-by: XueSheng-GIT <Michael.Frase@gmx.de> * Update composer.lock to get latest OCP * Update psalm baseline * Introduce OcrAlreadyDoneException and add tests * Add additional integration tests for new result code handling --------- Signed-off-by: XueSheng-GIT <Michael.Frase@gmx.de> Co-authored-by: Robin Windey <ro.windey@gmail.com>
…#319) * Gracefully handle already done ocr (#308) [Backport #308 to stable31] * Gracefully handle already done ocr Throw OcrResultEmptyException if OCRmyPDF returns exit code 6 (ExitCode.already_done_ocr). Fix of #293 Signed-off-by: XueSheng-GIT <Michael.Frase@gmx.de> * Update composer.lock to get latest OCP * Update psalm baseline * Introduce OcrAlreadyDoneException and add tests * Add additional integration tests for new result code handling --------- Signed-off-by: XueSheng-GIT <Michael.Frase@gmx.de> Co-authored-by: Robin Windey <ro.windey@gmail.com> * Apply php-cs-fixer changes (according to new OC ruleset) --------- Signed-off-by: XueSheng-GIT <Michael.Frase@gmx.de> Co-authored-by: XueSheng-GIT <Michael.Frase@gmx.de> Co-authored-by: R0Wi <R0Wi@users.noreply.github.com>



Throw OcrResultEmptyException if OCRmyPDF returns exit code 6 (ExitCode.already_done_ocr).
Fix of #293
@R0Wi:
Not sure whether existing check for empty file is still required for 'Local'? There's no such check for 'Remote'.
workflow_ocr/lib/OcrProcessors/Local/OcrMyPdfBasedProcessor.php
Lines 83 to 85 in 8fa36b4
Also not sure about the requirement for additional tests.