From c31fc35000637ac3276ae88110bed1ab8dd25dc0 Mon Sep 17 00:00:00 2001 From: Vetle Ledaal Date: Tue, 4 Jan 2022 19:56:30 +0000 Subject: [PATCH] Fix inconsistent json in Nekopost (#10336) --- src/th/nekopost/build.gradle | 2 +- .../eu/kanade/tachiyomi/extension/th/nekopost/Nekopost.kt | 3 ++- .../tachiyomi/extension/th/nekopost/model/RawPageItem.kt | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/th/nekopost/build.gradle b/src/th/nekopost/build.gradle index 5ff94f824..031dee5cb 100644 --- a/src/th/nekopost/build.gradle +++ b/src/th/nekopost/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Nekopost' pkgNameSuffix = 'th.nekopost' extClass = '.Nekopost' - extVersionCode = 6 + extVersionCode = 7 isNsfw = true } diff --git a/src/th/nekopost/src/eu/kanade/tachiyomi/extension/th/nekopost/Nekopost.kt b/src/th/nekopost/src/eu/kanade/tachiyomi/extension/th/nekopost/Nekopost.kt index af12433dd..325293c8e 100644 --- a/src/th/nekopost/src/eu/kanade/tachiyomi/extension/th/nekopost/Nekopost.kt +++ b/src/th/nekopost/src/eu/kanade/tachiyomi/extension/th/nekopost/Nekopost.kt @@ -141,9 +141,10 @@ class Nekopost : ParsedHttpSource() { val chapterInfo: RawChapterInfo = json.decodeFromString(responseBody.string()) chapterInfo.pageItem.map { page -> + val fileName = page.fileName ?: page.pageName Page( index = page.pageNo, - imageUrl = "$fileHost/collectManga/${chapterInfo.projectId}/${chapterInfo.chapterId}/${page.fileName}", + imageUrl = "$fileHost/collectManga/${chapterInfo.projectId}/${chapterInfo.chapterId}/$fileName", ) } } diff --git a/src/th/nekopost/src/eu/kanade/tachiyomi/extension/th/nekopost/model/RawPageItem.kt b/src/th/nekopost/src/eu/kanade/tachiyomi/extension/th/nekopost/model/RawPageItem.kt index 101060818..a126e120d 100644 --- a/src/th/nekopost/src/eu/kanade/tachiyomi/extension/th/nekopost/model/RawPageItem.kt +++ b/src/th/nekopost/src/eu/kanade/tachiyomi/extension/th/nekopost/model/RawPageItem.kt @@ -4,7 +4,10 @@ import kotlinx.serialization.Serializable @Serializable data class RawPageItem( - val fileName: String, + val id: Int? = null, + // workaround for https://github.com/Kotlin/kotlinx.serialization/pull/1473 + val fileName: String? = null, + val pageName: String? = null, val height: Int, val pageNo: Int, val width: Int