Repository navigation
feat(ocr): decide with sillybos before any decoder opens a scan - #88
Merged
Merged
Conversation
imaging.open_image and check_pdf now delegate the deciding to sillybos, the library that grew out of them: the format from the file's own bytes, the header read by bounded code of its own, a PDF asked about through pdfinfo in a separate process, and a reason in a sentence. Tetrak's limits stay as this module's constants and become the policy. Two things are stricter than before: a file whose extension disagrees with its contents is refused by name, and a TIFF's every frame is checked before Pillow opens the file rather than as each frame is reached. Co-authored-by: Yvette Mankerian <yvettekm@gmail.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Deploying tetrak with
|
| Latest commit: |
0024650
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://70f715a7.tetrak.pages.dev |
| Branch Preview URL: | https://feat-sillybos.tetrak.pages.dev |
Merged
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stage 1 of brief 022: Tetrak OCR takes
sillybos(0.1.0 on PyPI, pinned>=0.1,<1) andimaging.open_image/check_pdfbecome thin calls into it. Tetrak'sMAX_PIXELS,MAX_PDF_PAGESandPDF_RENDER_DPIstay as the policy's inputs, so nothing about the limits changes;InputRefusedErrornow carries sillybos's reasons.Stricter in two ways, both deliberate: a scan whose extension disagrees with its contents (a JPEG called
.png) is refused as "says PNG, is JPEG" rather than opened; and an oversized frame anywhere in a TIFF refuses the file at open, since the whole frame chain is checked before Pillow sees it. The_check_pixelsper-frame check goes as redundant.docs/installation.mdnames the check and corrects what Poppler is used for (pdfinfobefore rendering, so a missing poppler now stops with a message that says to install it).519 tests pass, 13 xfail as before. A
feat: it adds a dependency and refuses files it previously opened, so 5.21.0.🤖 Generated with Claude Code