Skip to content

fix: invalid image page_range crashes with AttributeError instead of clear error#1021

Open
YizukiAme wants to merge 1 commit intodatalab-to:masterfrom
YizukiAme:fix/image-provider-page-range-error
Open

fix: invalid image page_range crashes with AttributeError instead of clear error#1021
YizukiAme wants to merge 1 commit intodatalab-to:masterfrom
YizukiAme:fix/image-provider-page-range-error

Conversation

@YizukiAme
Copy link
Copy Markdown

Fixes #1019

Root cause
ImageProvider validated page_range with an assert, but the assertion message referenced self.doc, which does not exist for image inputs. Out-of-range values therefore crashed with AttributeError while formatting the message instead of surfacing a normal validation error.

Fix
This change replaces the assertion with an explicit ValueError that uses self.image_count for the bounds message and adds a regression test for an invalid single-image page_range.

@github-actions
Copy link
Copy Markdown
Contributor

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request

@YizukiAme
Copy link
Copy Markdown
Author

recheck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid image page_range crashes with AttributeError instead of a validation error

1 participant