fix: scope download folders by MangaDex UUID to prevent local chapters leaking across same-title entries#3068
Open
sassy-lily wants to merge 4 commits into
Conversation
…s leaking across same-title entries
Manga download directories were named by display title only, so two library
entries sharing the same title resolved to the same folder on disk. When
ChapterSourceSync scanned for local chapters it called getAllDownloadFiles()
for each manga, which returned the same files for both, inserting duplicate
local chapters under each manga_id.
Fix getMangaDirName() to embed the MangaDex UUID in the folder name
("Title [uuid]"), making each manga's directory unique. findMangaDir()
retains a title-only fallback so pre-existing downloads remain accessible.
renewCache() switches to UUID-based lookup and auto-migrates unambiguous
legacy folders on first cache rebuild. renameMangaFolder() is updated to
handle both old and new naming when the display title changes.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request implements a new folder naming convention for downloaded manga by appending the manga's UUID to the folder name, effectively preventing collisions between different series with identical titles. The changes include automatic migration of legacy folders during cache renewal and updates to the DownloadProvider to support both naming formats. Feedback identifies a bug in the migration logic where renamed folders are not indexed in the current cycle, leading to missing chapters in the UI. It is also suggested to filter the manga list by source ID to avoid cross-source title collisions.
Filter manga lookup to MangaDex source only to prevent cross-source title collisions, and fix legacy folder migration to index chapters in the current cache cycle instead of skipping them after rename. Co-Authored-By: Claude Sonnet 4.6 <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.
Discovered after re-initializing the app with a backup.
The app maps local or downloaded chapters back to a manga using the directory the chapters are located in matching only on the manga title.
When more than one manga with the same title is present in the library the local or downloaded chapters get duplicated in all manga with that name, creating non existing chapters.
Downloaded chapters are already uniquely identified by appending the chapter's UUID to the generated file.
Updating the directory generation logic and manga decoding logic to use the same pattern will prevent this problem and should also stabilize the directories resolution when the manga changes title (both from the source or the user).
Implementing an automatic fallback and update logic prevent losing already downloaded chapters.
Pre-existing ambiguous directories will not be updated, as there is no way to know to which entries they must be updated to and need to be fixed or re-downloaded manually.