-
-
Notifications
You must be signed in to change notification settings - Fork 516
Update the PDF Metadata Parser to Accept Lengths By ObjectRef #3933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Update the PDF Metadata Parser to Accept Lengths By ObjectRef #3933
Conversation
|
Can you explain a bit more about the fix and is there a way to write a unit test to trigger? |
Sure thing, I hope this helps. So the error I ran into was while importing multiple files in my Library. I tracked down the issue to the parser receiving an ObjectRef when it was expecting an int. To address it, I referred to some that was already in the file, specifically these two locations:
I implemented a private method that would use the existing stream to read the object reference using a temporary As for the other log messages, I added their types because it was really useful while debugging to see not only what it was expecting but what it received instead. It's possible that there are other areas that could benefit from resolving ObjectRefs, but without PDF test cases on hand, I only updated the processing of the Length field.
That might take me a little while. I don't see any existing tests referring to the |
|
It would be helpful if you could also send me (DM/email) a file that caused this issue, so I can test it out on my end as well. Feel free to ask for help here or discord. |
|
Spoke with the dev and got the file (Murder Die Senpai 1-2.pdf). I'll be looking into reproducing and setting up unit tests later in the cycle. Thanks again @zeroSteiner for the initial contribution. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the PDF metadata parser to handle cases where the Length field references an object reference instead of being a direct integer value, and improves error messaging throughout the parser. The changes include adding object reference resolution functionality and making exception messages more informative by indicating both expected and received types.
- Adds support for resolving ObjectRef values when parsing the Length field in PDF metadata
- Improves error messages to include the actual type received in addition to the expected type
- Introduces a new
ResolveObjectRefmethod to handle object reference resolution
Changed
Fixed
Thanks!