Some cleanup in the downloads cache and disk util

This commit is contained in:
Jays2Kings 2021-04-04 12:55:37 -04:00
parent cb025624eb
commit 4e4f9b339f
2 changed files with 3 additions and 3 deletions

View File

@ -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<Manga>, 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
}
}

View File

@ -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)