diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt index 1aedf7df7..b70dfd2a6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt @@ -284,10 +284,17 @@ class DownloadCache( mangaDirs.values.forEach { mangaDir -> val chapterDirs = mangaDir.dir.listFiles().orEmpty() - .mapNotNull { chapterDir -> - chapterDir.name - ?.replace(".cbz", "") - ?.takeUnless { it.endsWith(Downloader.TMP_DIR_SUFFIX) } + .mapNotNull { + when { + // Ignore incomplete downloads + it.name?.endsWith(Downloader.TMP_DIR_SUFFIX) == true -> null + // Folder of images + it.isDirectory -> it.name + // CBZ files + it.isFile && it.name?.endsWith(".cbz") == true -> it.name!!.replace(".cbz", "") + // Anything else is irrelevant + else -> null + } } .toMutableSet() diff --git a/i18n/src/main/res/values/strings.xml b/i18n/src/main/res/values/strings.xml index a625ccfb2..f44817b71 100644 --- a/i18n/src/main/res/values/strings.xml +++ b/i18n/src/main/res/values/strings.xml @@ -504,7 +504,7 @@ Cache cleared. %1$d files have been deleted Error occurred while clearing Clear chapter cache on app close - Reindex downloads + Invalidate downloads index Clear database Delete history for entries that are not saved in your library %1$d non-library entries in database