appItunesmeta: fix crash on string purchase/release/install dates#1613
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.
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(andconvert_time_obj_to_utc) expect a datetime object — they read.year/ call.replace(tzinfo=...). In someiTunesMetadata.plistfiles,purchaseDate(andreleaseDate/installDate) are stored as ISO strings rather than plist<date>objects, so the converter raised and aborted the whole artifact.Fix
Guard all three conversions: convert only when the value
isinstance(..., datetime); pass strings/empties through unchanged. TheApp Purchase Date/Installed Datecolumns are datetime-typed, so a pass-through ISO string is still parsed correctly by the framework.Pre-existing bug surfaced during testing.
Validation
purchaseDate(was crashing) passes through; datetimepurchaseDatestill converts to aware UTC.