Skip to content
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

fix: skip invalid_xref #74

Merged
merged 2 commits into from
Dec 3, 2024
Merged

Conversation

brandnday
Copy link

@brandnday brandnday commented Nov 7, 2024

What?

This PR is to address issue in #64
It is found that there is no problem with the pdf document, but the xref section is corrupted.

Why?

Our team use this library and found this issue when we upload pdf with invalid xref. Turns out this issue raised before

How?

It will precheck if the digits in xref object is valid, if it is not valid, it will just return the empty xref

Testing?

Ran the test locally

New Dependencies?

Screenshots

Suggested Reading?

Anything Else?

Checklist

  • I read CONTRIBUTING.md.
  • I read MAINTAINERSHIP.md#pull-requests.
  • I added/updated unit tests for my changes.
  • I added/updated integration tests for my changes.
  • I ran the integration tests.
  • I tested my changes in Node, Deno, and the browser.
  • I viewed documents produced with my changes in Adobe Acrobat, Foxit Reader, Firefox, and Chrome.
  • I added/updated doc comments for any new/modified public APIs.
  • My changes work for both new and existing PDF files.
  • I ran the linter on my changes.

@Sharcoux
Copy link
Collaborator

Sharcoux commented Nov 7, 2024

Your test case need to test a normal pdf and and corrupted one. You can manually corrupt a pdf existing in the repo if needed.

@brandnday
Copy link
Author

@Sharcoux I included the corrupted file (invalid_xref.pdf) and use it for the new unit test. I corrupt the file by copy pasting the corrupted xref section from the pdf mentioned in the issue. I also tested the new test case without the fix and it reproduce the error reported in the issue.

image

@Sharcoux Sharcoux merged commit f81a0b6 into cantoo-scribe:master Dec 3, 2024
1 check passed
@Sharcoux
Copy link
Collaborator

Sharcoux commented Dec 3, 2024

Merged. Will be released soon. Thanks ❤️

@Sharcoux
Copy link
Collaborator

Sharcoux commented Dec 7, 2024

Released

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

Successfully merging this pull request may close these issues.

2 participants