diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/BookLifecycle.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/BookLifecycle.kt
index a1629e659..eaed0455e 100644
--- a/komga/src/main/kotlin/org/gotson/komga/domain/service/BookLifecycle.kt
+++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/BookLifecycle.kt
@@ -39,8 +39,8 @@ import org.springframework.context.ApplicationEventPublisher
import org.springframework.data.domain.Pageable
import org.springframework.stereotype.Service
import org.springframework.transaction.support.TransactionTemplate
-import org.springframework.web.util.UriUtils
import java.io.File
+import java.net.URLDecoder
import java.time.LocalDateTime
import java.time.ZoneId
import kotlin.io.path.deleteIfExists
@@ -489,7 +489,7 @@ class BookLifecycle(
newProgression.locator.href
.replaceAfter("#", "")
.removeSuffix("#")
- .let { UriUtils.decode(it, Charsets.UTF_8) }
+ .let { URLDecoder.decode(it, Charsets.UTF_8) }
require(href in media.files.map { it.fileName }) { "Resource does not exist in book: $href" }
requireNotNull(newProgression.locator.locations?.progression) { "location.progression is required" }
diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/EpubExtractor.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/EpubExtractor.kt
index 69089f3da..cb577a07a 100644
--- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/EpubExtractor.kt
+++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/EpubExtractor.kt
@@ -17,7 +17,7 @@ import org.jsoup.Jsoup
import org.jsoup.parser.Parser
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Service
-import org.springframework.web.util.UriUtils
+import java.net.URLDecoder
import java.nio.file.Path
import kotlin.io.path.Path
import kotlin.io.path.deleteIfExists
@@ -91,7 +91,7 @@ class EpubExtractor(
val pages =
spine.map { page ->
MediaFile(
- normalizeHref(epub.opfDir, UriUtils.decode(page.href, Charsets.UTF_8)),
+ normalizeHref(epub.opfDir, URLDecoder.decode(page.href, Charsets.UTF_8)),
page.mediaType,
MediaFile.SubType.EPUB_PAGE,
)
@@ -100,7 +100,7 @@ class EpubExtractor(
val assets =
epub.manifest.values.filterNot { spine.contains(it) }.map {
MediaFile(
- normalizeHref(epub.opfDir, UriUtils.decode(it.href, Charsets.UTF_8)),
+ normalizeHref(epub.opfDir, URLDecoder.decode(it.href, Charsets.UTF_8)),
it.mediaType,
MediaFile.SubType.EPUB_ASSET,
)
diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/Nav.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/Nav.kt
index aa53a4c35..e4e0e6f9f 100644
--- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/Nav.kt
+++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/Nav.kt
@@ -4,7 +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.springframework.web.util.UriUtils
+import java.net.URLDecoder
import java.nio.file.Path
import kotlin.io.path.Path
@@ -34,7 +34,7 @@ private fun navLiElementToTocEntry(
navDir: Path?,
): EpubTocEntry? {
val title = element.selectFirst(":root > a, span")?.text()
- val href = element.selectFirst(":root > a")?.attr("href")?.let { UriUtils.decode(it, Charsets.UTF_8) }
+ val href = element.selectFirst(":root > a")?.attr("href")?.let { URLDecoder.decode(it, Charsets.UTF_8) }
val children = element.select(":root > ol > li").mapNotNull { navLiElementToTocEntry(it, navDir) }
if (title != null) return EpubTocEntry(title, href?.let { normalizeHref(navDir, it) }, children)
return null
diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/Ncx.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/Ncx.kt
index 9063f4424..2d07f4b54 100644
--- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/Ncx.kt
+++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/Ncx.kt
@@ -4,7 +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.springframework.web.util.UriUtils
+import java.net.URLDecoder
import java.nio.file.Path
import kotlin.io.path.Path
@@ -34,7 +34,7 @@ private fun ncxElementToTocEntry(
ncxDir: Path?,
): EpubTocEntry? {
val title = element.selectFirst("navLabel > text")?.text()
- val href = element.selectFirst("content")?.attr("src")?.let { UriUtils.decode(it, Charsets.UTF_8) }
+ val href = element.selectFirst("content")?.attr("src")?.let { URLDecoder.decode(it, Charsets.UTF_8) }
val children = element.select(":root > ${navType.level2}").toList().mapNotNull { ncxElementToTocEntry(navType, it, ncxDir) }
if (title != null) return EpubTocEntry(title, href?.let { normalizeHref(ncxDir, it) }, children)
return null
diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/Opf.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/Opf.kt
index 193ce26dc..2ce8daad2 100644
--- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/Opf.kt
+++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/Opf.kt
@@ -2,7 +2,7 @@ package org.gotson.komga.infrastructure.mediacontainer.epub
import org.gotson.komga.domain.model.EpubTocEntry
import org.jsoup.nodes.Document
-import org.springframework.web.util.UriUtils
+import java.net.URLDecoder
import java.nio.file.Path
import java.nio.file.Paths
import kotlin.io.path.invariantSeparatorsPathString
@@ -40,7 +40,7 @@ fun processOpfGuide(
return guide.select("reference").map { ref ->
EpubTocEntry(
ref.attr("title"),
- ref.attr("href").ifBlank { null }?.let { normalizeHref(opfDir, UriUtils.decode(it, Charsets.UTF_8)) },
+ ref.attr("href").ifBlank { null }?.let { normalizeHref(opfDir, URLDecoder.decode(it, Charsets.UTF_8)) },
)
}
}
diff --git a/komga/src/test/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/NcxTest.kt b/komga/src/test/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/NcxTest.kt
index 5b907f015..e98d508b3 100644
--- a/komga/src/test/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/NcxTest.kt
+++ b/komga/src/test/kotlin/org/gotson/komga/infrastructure/mediacontainer/epub/NcxTest.kt
@@ -64,6 +64,7 @@ class NcxTest {
),
),
EpubTocEntry("ACKNOWLEDGMENTS", "${prefix}Text/Mart_9780553897852_epub_ack_r1.htm"),
+ EpubTocEntry("Omake 1: Ichika’s Q&A", "${prefix}Text/First Omake - Ichika’s Q&A.xhtml"),
)
private fun getExpectedNcxPageList(prefix: String = "") =
diff --git a/komga/src/test/resources/epub/toc.ncx b/komga/src/test/resources/epub/toc.ncx
index ff2c7df14..92073930a 100644
--- a/komga/src/test/resources/epub/toc.ncx
+++ b/komga/src/test/resources/epub/toc.ncx
@@ -86,6 +86,12 @@
+
+
+ Omake 1: Ichika’s Q&A
+
+
+