Skip to content

Commit

Permalink
fix(opds): cannot download file with semicolon in filename
Browse files Browse the repository at this point in the history
closes gotson#309
  • Loading branch information
gotson committed Sep 6, 2020
1 parent afb8fbf commit e1e251e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e1e251e

Please sign in to comment.