Stop the Samsung My Files artifacts crashing when a database won't open - #1112
Merged
Conversation
open_sqlite_db_readonly returns None (and logs the reason) when a database cannot be opened. Five of the My Files artifacts called db.cursor() on that return without checking it, so a single database that failed to open raised "'NoneType' object has no attribute 'cursor'" and the unhandled exception failed the artifact. Mattia Epifani reported almost all the My Files plugins failing this way; on his Windows setup a very long output path made the open fail with "unable to open database file" (the same cause fixed for siminfo in PR #1111), and because these artifacts all target the same app they all fell over together. Guard the None return in smyFiles, smyFiles2, smyfilesOpHistory, smyfilesRecents and smyfilescache so an unopenable database is skipped and the artifact continues. smyfilesStored already caught this and is unchanged. Verified two ways: with open_sqlite_db_readonly forced to return None the three query helpers now return empty instead of raising AttributeError; and a full My Files profile run against a real com.sec.android.app.myfiles extraction is unchanged (smyfilesStored 2048, My Files Cache 2048, Recent Files 100 and 100, and the genuinely-empty download_history/googledrive still reporting no data), with no errors. Co-Authored-By: Claude Opus 5 <noreply@anthropic.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.
Summary
open_sqlite_db_readonlyreturnsNone(and logs the reason) when a database can't be opened. Five of the Samsung My Files artifacts calleddb.cursor()on that return without checking it, so a single database that failed to open raised'NoneType' object has no attribute 'cursor'and the unhandled exception failed the artifact.Mattia Epifani reported almost all the My Files plugins failing this way. On his Windows setup a very long output path made the open fail with
unable to open database file(same root cause fixed forsiminfoin #1111); because these artifacts all target the same app, they all fell over together.Fix
Guard the
Nonereturn insmyFiles,smyFiles2,smyfilesOpHistory,smyfilesRecentsandsmyfilescacheso an unopenable database is skipped and the artifact continues.smyfilesStoredalready caught this (bareexcept) and is unchanged.Validation
open_sqlite_db_readonlyforced to returnNone, the three undecorated query helpers (_query,_rows,get_db_data) now return[]/0instead of raisingAttributeError; before the changedb.cursor()onNoneraised exactly Mattia's error.com.sec.android.app.myfilesextraction is unchanged:smyfilesStored2048,My Files Cache2048,Recent Files100 and 100; the genuinely-emptydownload_history/googledrivestill report no data; no errors, exit 0.Pylint 10.00, claim-language and validate_sample_data clean. Reporter's extraction is private and not committed.
Notes (not in this PR)
\\?\) open failure is a core issue affecting every SQLite artifact (already flagged separately). This PR makes the My Files artifacts degrade gracefully; recovering the data on very long Windows paths is the separate core fix.My Files Operation Historyis intentionally gated to Android 10-12 and its path cipher differs on Android 13+ (it flags those entries*unsupported entry*). Decoding the newer cipher is separate research, not this crash fix.Co-Authored-By: Claude Opus 5 noreply@anthropic.com
🤖 Generated with Claude Code