Skip to content

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
nekomangaorg:mainfrom
sassy-lily:fix/local-chapters-duplicate-title-collision
Open

fix: scope download folders by MangaDex UUID to prevent local chapters leaking across same-title entries#3068
sassy-lily wants to merge 4 commits into
nekomangaorg:mainfrom
sassy-lily:fix/local-chapters-duplicate-title-collision

Conversation

@sassy-lily

Copy link
Copy Markdown
Contributor

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.

…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>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt Outdated
sassy-lily and others added 3 commits May 14, 2026 23:07
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant