From 9bf3f15fff96b48e6847034c9fcd07f14675130b Mon Sep 17 00:00:00 2001 From: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Date: Thu, 7 Aug 2025 09:05:15 +0600 Subject: [PATCH] Fix local source EPUB files not loading (#2369) --- CHANGELOG.md | 3 ++- .../archive/src/main/kotlin/mihon/core/archive/EpubReader.kt | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4fd9ec27..2c2a1f8f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,8 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co - LocalSource now reads ComicInfo.xml file for chapter (if available) to display chapter title, number and scanlator ([@raxod502](https://github.com/radian-software)) ([#2332](https://github.com/mihonapp/mihon/pull/2332)) ### Fixes -- Fixed scrollbar sometimes not showing during scroll or not reaching the bottom with few items ([@anirudhsnayak](https://github.com/anirudhsnayak)) ([#2304](https://github.com/mihonapp/mihon/pull/2304)) +- Fix scrollbar sometimes not showing during scroll or not reaching the bottom with few items ([@anirudhsnayak](https://github.com/anirudhsnayak)) ([#2304](https://github.com/mihonapp/mihon/pull/2304)) +- Fix local source EPUB files not loading ([@AntsyLich](https://github.com/AntsyLich)) ([#2369](https://github.com/mihonapp/mihon/pull/2369)) ### Removed - Predictive back support ([@AntsyLich](https://github.com/AntsyLich)) ([#2362](https://github.com/mihonapp/mihon/pull/2362)) diff --git a/core/archive/src/main/kotlin/mihon/core/archive/EpubReader.kt b/core/archive/src/main/kotlin/mihon/core/archive/EpubReader.kt index 620602c81..b6b0c79f5 100644 --- a/core/archive/src/main/kotlin/mihon/core/archive/EpubReader.kt +++ b/core/archive/src/main/kotlin/mihon/core/archive/EpubReader.kt @@ -2,6 +2,7 @@ package mihon.core.archive import org.jsoup.Jsoup import org.jsoup.nodes.Document +import org.jsoup.parser.Parser import java.io.Closeable import java.io.File import java.io.InputStream @@ -39,7 +40,7 @@ class EpubReader(private val reader: ArchiveReader) : Closeable by reader { fun getPackageHref(): String { val meta = getInputStream(resolveZipPath("META-INF", "container.xml")) if (meta != null) { - val metaDoc = meta.use { Jsoup.parse(it, null, "") } + val metaDoc = meta.use { Jsoup.parse(it, null, "", Parser.xmlParser()) } val path = metaDoc.getElementsByTag("rootfile").first()?.attr("full-path") if (path != null) { return path @@ -52,7 +53,7 @@ class EpubReader(private val reader: ArchiveReader) : Closeable by reader { * Returns the package document where all the files are listed. */ fun getPackageDocument(ref: String): Document { - return getInputStream(ref)!!.use { Jsoup.parse(it, null, "") } + return getInputStream(ref)!!.use { Jsoup.parse(it, null, "", Parser.xmlParser()) } } /**