From 597f1ad8d1a5cd0fb0d7d0c4b33fd790c70ffdeb Mon Sep 17 00:00:00 2001 From: lamaxama <163385206+lamaxama@users.noreply.github.com> Date: Thu, 18 Apr 2024 01:37:34 +0800 Subject: [PATCH] Elarc Toon: Skip responses that do not start with "text/html" (#2462) * Elarc Toon: Skip responses that do not start with "text/html" * Update build.gradle * format --- src/en/elarcpage/build.gradle | 2 +- .../eu/kanade/tachiyomi/extension/en/elarcpage/ElarcPage.kt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/en/elarcpage/build.gradle b/src/en/elarcpage/build.gradle index 47f715d41..8328b619f 100644 --- a/src/en/elarcpage/build.gradle +++ b/src/en/elarcpage/build.gradle @@ -3,7 +3,7 @@ ext { extClass = '.ElarcPage' themePkg = 'mangathemesia' baseUrl = 'https://elarctoons.com' - overrideVersionCode = 5 + overrideVersionCode = 6 isNsfw = false } diff --git a/src/en/elarcpage/src/eu/kanade/tachiyomi/extension/en/elarcpage/ElarcPage.kt b/src/en/elarcpage/src/eu/kanade/tachiyomi/extension/en/elarcpage/ElarcPage.kt index 24bc44682..4380c43aa 100644 --- a/src/en/elarcpage/src/eu/kanade/tachiyomi/extension/en/elarcpage/ElarcPage.kt +++ b/src/en/elarcpage/src/eu/kanade/tachiyomi/extension/en/elarcpage/ElarcPage.kt @@ -52,6 +52,12 @@ class ElarcPage : MangaThemesia( // Always update URL val response = chain.proceed(request) + + // Skip responses that do not start with "text/html" + if (response.header("content-type")?.startsWith("text/html") != true) { + return response + } + val document = Jsoup.parse( response.peekBody(Long.MAX_VALUE).string(), request.url.toString(),