Repository navigation
Read a JSON Feed item's modification date from the spec field - #614
Open
rahul05ranjan wants to merge 1 commit into
Open
rahul05ranjan wants to merge 1 commit into
rahul05ranjan wants to merge 1 commit into
Conversation
The JSON Feed parser guarded on a nonstandard date_updated key while reading the spec's date_modified field, so an item carrying only date_modified (the spec's only spelling) never set updated — and consumers saw the published date as updated through the issue-310 fallback. Accept both spellings, preferring the spec field. Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com>
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.
The bug
The JSON Feed parser guards on a nonstandard
date_updatedkey while reading the spec'sdate_modifiedfield:JSON Feed's spec defines
date_publishedanddate_modified—date_updatedis not a spec field. So an item carrying onlydate_modifiednever setsupdated, and through the issue-#310 compatibility fallback, consumers then see the published date asupdated— silently serving a stale timestamp:(Also: a feed that used the old nonstandard
date_updatedspelling alone hit aKeyErrorondate_modifiedinstead of parsing.)The fix
Accept both spellings, preferring the spec field:
date_modifiedwhen present, else the legacydate_updated.Verification
tests/json/:date_modified.jsonpins that a spec-compliant item'supdatedis the modification date andupdated_parsedmatches (whilepublishedstays intact), anddate_updated_only.jsonpins that the legacy spelling alone no longer raises. Both fail on current main (updatedfalls back to the published date, triggering the [Bug] SSLCertVerificationError for URL with valid certificate. #310 deprecation warning), both pass with this change.test_ill_formed.py/test_well_formed.py(they require theresponsesHTTP-mocking package, unavailable here): 841 passed / 48 failed with the fix vs 839/50 on unmodified main — the delta is exactly the two new fixtures flipping, and the 48 failures are the sametest_encoding.py::test_http_encoding_filecases that need real HTTP mocking and fail identically on main on this machine (system Python 3.13.5, run from a checkout without installing).changelog.d/_6-rahul05ranjan-jsonfeed-date-modified.rstadded.