From 616ed4637d69dd1f329827a1df790240e62e0fff Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sun, 29 Oct 2023 16:02:02 +0100 Subject: [PATCH] Handle disabled download ahead limit for new chapters auto download (#734) In case download ahead is disabled, all new chapters should get downloaded. Due to incorrectly calculating the index of the first new chapter to download, no new chapter was downloaded at all --- .../main/kotlin/suwayomi/tachidesk/manga/impl/Chapter.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Chapter.kt b/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Chapter.kt index fdc8f8cce..952f35d0d 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Chapter.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Chapter.kt @@ -243,7 +243,11 @@ object Chapter { } val firstChapterToDownloadIndex = - (numberOfNewChapters - serverConfig.autoDownloadAheadLimit.value).coerceAtLeast(0) + if (serverConfig.autoDownloadAheadLimit.value > 0) { + (numberOfNewChapters - serverConfig.autoDownloadAheadLimit.value).coerceAtLeast(0) + } else { + 0 + } val chapterIdsToDownload = newChapters.subList(firstChapterToDownloadIndex, numberOfNewChapters)