fix(photosDbexif): Implement dynamic detection of asset tables in photosDbexif.py #1399
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.
Previously, the script hardcoded queries to the
ZASSETtable (standard in iOS 13+). iOS 12 usesZGENERICASSET. This PR implements dynamic table detection to support both schema versions and adds error handling for corrupted databases.Changes
get_asset_table_name(db_path)helper function to checksqlite_masterforZASSETorZGENERICASSET.get_photosDbexifnow uses the detected table name to build the SQL query dynamically.try-exceptblocks around the main query execution to prevent crashes on malformed databases.Verification & Testing
I have created a comprehensive test suite (test_photosDbexif_fix.py) to verify the fix across different schema versions.
ZASSETdetection and querying.ZGENERICASSETdetection and querying (The Fix).Test Output Summary:
Checklist