From 4e4f9b339f6217e3d4f8a5248b30c80439d4b820 Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Sun, 4 Apr 2021 12:55:37 -0400 Subject: [PATCH] Some cleanup in the downloads cache and disk util --- .../java/eu/kanade/tachiyomi/data/download/DownloadCache.kt | 4 ++-- .../main/java/eu/kanade/tachiyomi/util/storage/DiskUtil.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 d74003c159..80dcdc7172 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 @@ -126,7 +126,7 @@ class DownloadCache( val sourceDirs = getDirectoryFromPreference().listFiles().orEmpty() .associate { it.name to SourceDirectory(it) }.mapNotNullKeys { entry -> - onlineSources.find { provider.getSourceDirName(it).toLowerCase() == entry.key?.toLowerCase() }?.id + onlineSources.find { provider.getSourceDirName(it).equals(entry.key, ignoreCase = true) }?.id } val db: DatabaseHelper by injectLazy() @@ -159,7 +159,7 @@ class DownloadCache( */ private fun findManga(mangaList: List, mangaKey: String, sourceKey: Long): Manga? { return mangaList.find { - DiskUtil.buildValidFilename(it.originalTitle).toLowerCase() == mangaKey.toLowerCase() && it.source == sourceKey + DiskUtil.buildValidFilename(it.originalTitle).equals(mangaKey, ignoreCase = true) && it.source == sourceKey } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/storage/DiskUtil.kt b/app/src/main/java/eu/kanade/tachiyomi/util/storage/DiskUtil.kt index f4bab4b681..d44a63b5d7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/storage/DiskUtil.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/storage/DiskUtil.kt @@ -85,7 +85,7 @@ object DiskUtil { */ fun buildValidFilename(origName: String): String { val name = origName.trim('.', ' ') - if (name.isNullOrEmpty()) { + if (name.isEmpty()) { return "(invalid)" } val sb = StringBuilder(name.length)