mirror of
https://github.com/gotson/komga.git
synced 2026-05-09 05:10:19 +02:00
refactor: use Jsoup XmlParser instead of HTML parser where needed
This commit is contained in:
parent
8b629888ff
commit
4e7c49d5d8
2 changed files with 3 additions and 2 deletions
|
|
@ -30,7 +30,7 @@ inline fun <R> Path.epub(block: (EpubPackage) -> R): R =
|
|||
*/
|
||||
fun ZipFile.getPackagePath(): String =
|
||||
getEntryInputStream("META-INF/container.xml")
|
||||
?.use { Jsoup.parse(it, null, "") }
|
||||
?.use { Jsoup.parse(it, null, "", Parser.xmlParser()) }
|
||||
?.getElementsByTag("rootfile")
|
||||
?.first()
|
||||
?.attr("full-path") ?: throw MediaUnsupportedException("META-INF/container.xml does not contain rootfile tag")
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import org.gotson.komga.domain.model.EpubTocEntry
|
|||
import org.gotson.komga.infrastructure.util.getEntryBytes
|
||||
import org.jsoup.Jsoup
|
||||
import org.jsoup.nodes.Element
|
||||
import org.jsoup.parser.Parser
|
||||
import java.net.URLDecoder
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.Path
|
||||
|
|
@ -23,7 +24,7 @@ fun processNcx(
|
|||
navType: Epub2Nav,
|
||||
): List<EpubTocEntry> =
|
||||
Jsoup
|
||||
.parse(document.content)
|
||||
.parse(document.content, "", Parser.xmlParser())
|
||||
.select("${navType.level1} > ${navType.level2}")
|
||||
.toList()
|
||||
.mapNotNull { ncxElementToTocEntry(navType, it, document.path.parent) }
|
||||
|
|
|
|||
Loading…
Reference in a new issue