From 4b9a6541d13de64d0a9b85e1afb4e143492cb5fe Mon Sep 17 00:00:00 2001 From: stevenyomi <95685115+stevenyomi@users.noreply.github.com> Date: Thu, 25 Aug 2022 05:19:01 +0800 Subject: [PATCH] Fix chapter download with empty scanlator (#7844) --- .../eu/kanade/tachiyomi/data/download/DownloadProvider.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt index 3abbf12de..b2d9e9dcd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt @@ -139,14 +139,15 @@ class DownloadProvider(private val context: Context) { fun getChapterDirName(chapterName: String, chapterScanlator: String?): String { return DiskUtil.buildValidFilename( when { - chapterScanlator != null -> "${chapterScanlator}_$chapterName" + chapterScanlator.isNullOrBlank().not() -> "${chapterScanlator}_$chapterName" else -> chapterName }, ) } fun isChapterDirNameChanged(oldChapter: DomainChapter, newChapter: DomainChapter): Boolean { - return oldChapter.name != newChapter.name || oldChapter.scanlator != newChapter.scanlator + return oldChapter.name != newChapter.name || + oldChapter.scanlator?.takeIf { it.isNotBlank() } != newChapter.scanlator?.takeIf { it.isNotBlank() } } /** @@ -164,7 +165,7 @@ class DownloadProvider(private val context: Context) { // Archived chapters add("$chapterDirName.cbz") - if (chapterScanlator == null) { + if (chapterScanlator.isNullOrBlank()) { // Previously null scanlator fields were converted to "" due to a bug add("_$chapterDirName") add("_$chapterDirName.cbz")