From e1e251ec2f384892d7705ab590c318cf0e3232bb Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Sun, 6 Sep 2020 11:46:41 +0800 Subject: [PATCH] fix(opds): cannot download file with semicolon in filename closes #309 --- .../kotlin/org/gotson/komga/interfaces/opds/OpdsController.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/opds/OpdsController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/opds/OpdsController.kt index b9ee9686a..a84881bbc 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/opds/OpdsController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/opds/OpdsController.kt @@ -436,12 +436,14 @@ class OpdsController( links = listOf( OpdsLinkImageThumbnail("image/jpeg", "${routeBase}books/${book.id}/thumbnail"), OpdsLinkImage(media.pages[0].mediaType, "${routeBase}books/${book.id}/pages/1"), - OpdsLinkFileAcquisition(media.mediaType, "${routeBase}books/${book.id}/file/${book.fileName()}"), + OpdsLinkFileAcquisition(media.mediaType, "${routeBase}books/${book.id}/file/${sanitize(book.fileName())}"), opdsLinkPageStreaming ) ) } + private fun sanitize(fileName: String): String = fileName.replace(";", "") + private fun Library.toOpdsEntry(): OpdsEntryNavigation = OpdsEntryNavigation( title = name,