Skip to content

Conversation

@yuming-long
Copy link
Contributor

Summary

Instead of manually checking filename with .pdf extension and return is_pdf = false -> use currently pdf library to read file content to decide if the file content is valid pdf

@awalker4
Copy link
Collaborator

LGTM! I'd just suggest removing the logging when a file can't be loaded in pypdf. For a .doc, I see this:

INFO: Preparing to split document for partition.
ERROR: 'utf-8' codec can't decode byte 0xd0 in position 0: invalid continuation byte
WARNING: The file does not appear to be a valid PDF.
INFO: Partitioning without split.

If any non pdf is expected to hit this path, we can remove the scary ERROR and WARNING.

@yuming-long yuming-long changed the title chore [RUDOLPH-98] Use pdf library to check file without extension chore Use pdf library to check file without extension Sep 26, 2024
Copy link
Collaborator

@awalker4 awalker4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending the last comment!

@yuming-long yuming-long enabled auto-merge (squash) September 26, 2024 23:19
@yuming-long yuming-long merged commit 0c95c76 into main Oct 2, 2024
7 checks passed
@yuming-long yuming-long deleted the yuming/RUDOLPH-98_pdf_split_not_relay_on_file_extend branch October 2, 2024 22:31
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.

3 participants