Guard date-converter calls in 9 artifacts against string/empty dates#1614
Merged
Conversation
convert_plist_date_to_utc / convert_time_obj_to_utc expect a datetime object (they read
.year / call .replace(tzinfo=...)). In some iTunesMetadata.plist files purchaseDate (and
releaseDate/installDate) are stored as ISO strings rather than plist <date> objects, so the
converters raised AttributeError ('str' object has no attribute 'year') and aborted the
artifact. Guard all three: convert only datetime objects; pass strings through unchanged
(the framework parses ISO strings for the datetime columns).
Pre-existing bug surfaced during testing.
convert_plist_date_to_utc / convert_time_obj_to_utc expect a datetime object and crash (AttributeError / TypeError) when handed a string or empty value - which happens when a plist stores a date as an ISO string rather than a <date> object (the appItunesmeta crash seen in testing). Route each artifact's calls through a small local guard that converts only datetime objects and passes strings/None/empties through unchanged. Covers: appleAlarms, appleWifiPlist, biomeIntents, biomeUseractmeta, booking, callHistoryTransactions, cloudkit_cache, instagramThreads, weatherAppLocations. A framework-level fix of the two converters is the proper long-term solution but is blocked by pre-existing lint debt in ilapfuncs.py (CI lints the whole changed file); tracked separately. pylint 10.00 on all 9; guards verified to convert datetimes and pass through strings/None.
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.
Problem
convert_plist_date_to_utc/convert_time_obj_to_utcexpect a datetime object and crash (AttributeError/TypeError) when handed a string or empty value — which happens when a plist stores a date as an ISO string rather than a<date>object. This is the same root cause as the appItunesmeta crash from testing (#1613); these 9 artifacts call the same converters and would hit it on similar data.Fix
Route each artifact's converter calls through a small local guard (
_safe_plist_date/_safe_time_obj) that converts onlydatetimeinstances and passes strings/None/empties through unchanged.Covers: appleAlarms, appleWifiPlist, biomeIntents, biomeUseractmeta, booking, callHistoryTransactions, cloudkit_cache, instagramThreads, weatherAppLocations.
Note
The proper fix is hardening the two converters in
ilapfuncs.pydirectly (one change for all + future artifacts), but CI lints the whole changed file andilapfuncs.pyhas 35 pre-existing issues (including a realE0601 used-before-assignmenterror) — so that's tracked as a separate dedicated cleanup.Validation