diff --git a/src/all/tappytoon/build.gradle b/src/all/tappytoon/build.gradle index 688dab8f6..eb09fb8a5 100644 --- a/src/all/tappytoon/build.gradle +++ b/src/all/tappytoon/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Tappytoon' pkgNameSuffix = 'all.tappytoon' extClass = '.TappytoonFactory' - extVersionCode = 4 + extVersionCode = 5 isNsfw = true } diff --git a/src/all/tappytoon/src/eu/kanade/tachiyomi/extension/all/tappytoon/Tappytoon.kt b/src/all/tappytoon/src/eu/kanade/tachiyomi/extension/all/tappytoon/Tappytoon.kt index f5d359c21..f25e7df8a 100644 --- a/src/all/tappytoon/src/eu/kanade/tachiyomi/extension/all/tappytoon/Tappytoon.kt +++ b/src/all/tappytoon/src/eu/kanade/tachiyomi/extension/all/tappytoon/Tappytoon.kt @@ -30,9 +30,16 @@ class Tappytoon(override val lang: String) : HttpSource() { override val client = network.client.newBuilder().addInterceptor { chain -> val res = chain.proceed(chain.request()) - if (res.isSuccessful) return@addInterceptor res + val mime = res.headers["Content-Type"] + if (res.isSuccessful) { + if (mime != "application/octet-stream") + return@addInterceptor res + // Fix Content-Type header + return@addInterceptor res.newBuilder() + .header("Content-Type", "image/jpeg").build() + } // Throw JSON error if available - if (res.headers["Content-Type"] == "application/json") { + if (mime == "application/json") { res.body?.string()?.let(json::parseToJsonElement)?.run { throw Error(jsonObject["message"]!!.jsonPrimitive.content) }