mirror of
https://github.com/gotson/komga.git
synced 2025-12-06 08:32:25 +01:00
fix: epubs would have a "null" comment in the Media
This commit is contained in:
parent
3638bb3122
commit
343add1047
2 changed files with 18 additions and 1 deletions
|
|
@ -202,7 +202,12 @@ class BookAnalyzer(
|
||||||
.map { it.fileName }
|
.map { it.fileName }
|
||||||
.ifEmpty { null }
|
.ifEmpty { null }
|
||||||
?.joinToString(prefix = "ERR_1033 [", postfix = "]") { it }
|
?.joinToString(prefix = "ERR_1033 [", postfix = "]") { it }
|
||||||
val allErrors = (errors + entriesErrorSummary).joinToString(" ")
|
|
||||||
|
val allErrors =
|
||||||
|
(errors + entriesErrorSummary)
|
||||||
|
.filterNotNull()
|
||||||
|
.joinToString(" ")
|
||||||
|
.ifBlank { null }
|
||||||
|
|
||||||
return Media(
|
return Media(
|
||||||
status = Media.Status.READY,
|
status = Media.Status.READY,
|
||||||
|
|
|
||||||
|
|
@ -162,6 +162,18 @@ class BookAnalyzerTest(
|
||||||
assertThat(media.pages).hasSize(0)
|
assertThat(media.pages).hasSize(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `given regular epub archive when analyzing then comment is empty`() {
|
||||||
|
val file = ClassPathResource("epub/The Incomplete Theft - Ralph Burke.epub")
|
||||||
|
val book = Book("book", file.url, LocalDateTime.now())
|
||||||
|
|
||||||
|
val media = bookAnalyzer.analyze(book, false)
|
||||||
|
|
||||||
|
assertThat(media.mediaType).isEqualTo("application/epub+zip")
|
||||||
|
assertThat(media.status).isEqualTo(Media.Status.READY)
|
||||||
|
assertThat(media.comment).isNull()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `given epub archive when toc cannot be extracted then media status is READY with comments`() {
|
fun `given epub archive when toc cannot be extracted then media status is READY with comments`() {
|
||||||
val file = ClassPathResource("epub/The Incomplete Theft - Ralph Burke.epub")
|
val file = ClassPathResource("epub/The Incomplete Theft - Ralph Burke.epub")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue