fix: only delete app-managed files when clearing download storage#675
Open
thereisnotime wants to merge 3 commits into
Open
fix: only delete app-managed files when clearing download storage#675thereisnotime wants to merge 3 commits into
thereisnotime wants to merge 3 commits into
Conversation
justfile covers the most common dev tasks: debug/release builds for both flavors, lint, unit tests, APK listing, dependency inspection, and Gradle wrapper upgrades. CI runs lint + unit tests on every push and PR to main/development, then gates a debug build on passing checks. Lint reports and test results are uploaded as artifacts for easy inspection.
The delete loop in DeleteDownloadStorageDialog was calling file.delete() on every file in the user-selected folder, wiping anything else stored there alongside app downloads. Now it checks each filename against ExternalDownloadMetadataStore before deleting, so only files the app actually downloaded are removed. The normalization logic that was duplicated in ExternalAudioWriter is consolidated into ExternalDownloadMetadataStore.normalizeKey() so both codepaths stay in sync. Fixes eddyizm#588
eddyizm
reviewed
May 16, 2026
eddyizm
reviewed
May 16, 2026
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.
Fixes #588.
Supersedes #672 (which targeted main by mistake).
What was happening
DeleteDownloadStorageDialogcalledfile.delete()on every file in the user-selected folder with no ownership check. If the user pointed the app at a folder that also contained other files, those were deleted too.Fix
Before deleting, each file is now checked against
ExternalDownloadMetadataStore. Only files the app recorded as downloads are removed.ExternalDownloadMetadataStoregets two new methods:isTrackedFile(String fileName)— strips the extension, normalizes the base name, and checks the storenormalizeKey(String name)— the shared normalization logic (previously duplicated privately inExternalAudioWriter);ExternalAudioWriter.normalizeForComparisonnow delegates to it so both stay in syncChanges
DeleteDownloadStorageDialog.java— guardfile.delete()withisTrackedFilecheckExternalDownloadMetadataStore.java— addisTrackedFileandnormalizeKeyExternalAudioWriter.java— delegatenormalizeForComparisontonormalizeKey, remove duplicate logic