From 1cefaf0867951345ad4fb84f5efb539e41f506a1 Mon Sep 17 00:00:00 2001 From: Ritox2 Date: Sun, 20 Nov 2022 12:57:47 -0800 Subject: [PATCH] Fix for when a request requests page 1 (#14323) * Fix for #14276 * increase versionCode * fixed issue with requests going to page 1 Co-authored-by: Alec --- src/all/ehentai/build.gradle | 2 +- .../eu/kanade/tachiyomi/extension/all/ehentai/EHentai.kt | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/all/ehentai/build.gradle b/src/all/ehentai/build.gradle index d6879e2de..0ec182b9a 100644 --- a/src/all/ehentai/build.gradle +++ b/src/all/ehentai/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'E-Hentai' pkgNameSuffix = 'all.ehentai' extClass = '.EHFactory' - extVersionCode = 18 + extVersionCode = 19 isNsfw = true } diff --git a/src/all/ehentai/src/eu/kanade/tachiyomi/extension/all/ehentai/EHentai.kt b/src/all/ehentai/src/eu/kanade/tachiyomi/extension/all/ehentai/EHentai.kt index 3770d6b44..ad41256d1 100644 --- a/src/all/ehentai/src/eu/kanade/tachiyomi/extension/all/ehentai/EHentai.kt +++ b/src/all/ehentai/src/eu/kanade/tachiyomi/extension/all/ehentai/EHentai.kt @@ -171,6 +171,7 @@ abstract class EHentai( if (uri.toString().contains("f_spf") || uri.toString().contains("f_spt")) { if (page > 1) uri.appendQueryParameter("from", lastMangaId) } + return exGet(uri.toString(), page) } @@ -181,8 +182,10 @@ abstract class EHentai( override fun latestUpdatesParse(response: Response) = genericMangaParse(response) private fun exGet(url: String, page: Int? = null, additionalHeaders: Headers? = null, cache: Boolean = true): Request { + //pages no longer exist, if app attempts to go to the first page after a request, do not include the page append + val pageIndex = if (page == 1) null else page return GET( - page?.let { + pageIndex?.let { addParam(url, "next", lastMangaId) } ?: url, additionalHeaders?.let { header -> @@ -194,6 +197,7 @@ abstract class EHentai( } headers.build() } ?: headers + ).let { if (!cache) { it.newBuilder().cacheControl(CacheControl.FORCE_NETWORK).build()