Repository navigation
Conversation
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.
Summary
The handwritten PDF date parser drops the UTC offset and returns
Nonefor partial dates such asD:202404. Read the two public pypdf date properties and recover independently from an invalid date field. Dates with an explicit offset now carrytzinfo. Callers comparing these dates with naive datetimes may need to normalize them.List of files changed and why
crawl4ai/processors/pdf/processor.pycontains the behavior fix.tests/unit/test_pdf_metadata_dates.pyexercises the public entry point with offline regression inputs.How Has This Been Tested?
The tests generate real PDFs and exercise
PDFContentScrapingStrategy.scrap(). They cover UTC, positive and negative offsets, partial dates, missing dates and malformed metadata.On Windows with Python 3.11 and pypdf 7.0.0 where applicable, the targeted tests report
3 failed, 2 passedon develop and5 passedwith the patch. The related run reports30 passed.git diff --check, Python compilation and Black for the changed test file pass. The scoped source-file Black check reports pre-existing whitespace-only formatting. The complete source file has baseline Black failures. Validation covers the named local suites.Checklist:
Prepared with AI assistance. The problem was discovered and reproduced from develop source.