From 544bf2ea210c5c5287ded0e280ddc91ab614f4b7 Mon Sep 17 00:00:00 2001 From: akabhirav <108609220+akabhirav@users.noreply.github.com> Date: Sun, 12 Feb 2023 20:34:30 +0530 Subject: [PATCH] fix Page index issues for some providers (#491) --- .../src/main/kotlin/suwayomi/tachidesk/manga/impl/Page.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Page.kt b/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Page.kt index be976a7e..d70275b8 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Page.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Page.kt @@ -11,6 +11,7 @@ import eu.kanade.tachiyomi.source.local.LocalSource import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.online.HttpSource import kotlinx.coroutines.flow.StateFlow +import org.jetbrains.exposed.sql.SortOrder import org.jetbrains.exposed.sql.and import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.transactions.transaction @@ -49,8 +50,11 @@ object Page { val chapterId = chapterEntry[ChapterTable.id].value val pageEntry = - transaction { PageTable.select { (PageTable.chapter eq chapterId) and (PageTable.index eq index) }.first() } - + transaction { + PageTable.select { (PageTable.chapter eq chapterId) } + .orderBy(PageTable.index to SortOrder.ASC) + .limit(1, index.toLong()).first() + } val tachiyomiPage = Page( pageEntry[PageTable.index], pageEntry[PageTable.url],