fix: some epub resources would not be detected properly

Closes: #1442
Closes: #1441
This commit is contained in:
Gauthier Roebroeck 2024-03-12 11:06:55 +08:00
parent d34d4a5653
commit f8e40ce968

View file

@ -14,6 +14,7 @@ import org.gotson.komga.infrastructure.mediacontainer.ContentDetector
import org.jsoup.Jsoup
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Service
import org.springframework.web.util.UriUtils
import java.nio.file.Path
import kotlin.io.path.Path
import kotlin.io.path.invariantSeparatorsPathString
@ -98,7 +99,7 @@ class EpubExtractor(
val pages =
spine.map { page ->
MediaFile(
normalizeHref(epub.opfDir, page.href),
normalizeHref(epub.opfDir, UriUtils.decode(page.href, Charsets.UTF_8)),
page.mediaType,
MediaFile.SubType.EPUB_PAGE,
)
@ -107,7 +108,7 @@ class EpubExtractor(
val assets =
epub.manifest.values.filterNot { spine.contains(it) }.map {
MediaFile(
normalizeHref(epub.opfDir, it.href),
normalizeHref(epub.opfDir, UriUtils.decode(it.href, Charsets.UTF_8)),
it.mediaType,
MediaFile.SubType.EPUB_ASSET,
)