Skip to content

Commit

Permalink
fix(opds): incorrect url encode for next/previous links
Browse files Browse the repository at this point in the history
closes #792
  • Loading branch information
gotson committed Feb 4, 2022
1 parent c12701c commit 288858c
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,15 @@ class OpdsController(
.fromPath("$routeBase$path")

private fun <T> linkPage(uriBuilder: UriComponentsBuilder, page: Page<T>): List<OpdsLink> {
val pageBuilder = uriBuilder.cloneBuilder()
.queryParam("page", "{page}")
.build()
return listOfNotNull(
if (!page.isFirst) OpdsLinkFeedNavigation(
OpdsLinkRel.PREVIOUS,
pageBuilder.expand(mapOf("page" to page.pageable.previousOrFirst().pageNumber)).toUriString(),
uriBuilder.cloneBuilder().queryParam("page", page.pageable.previousOrFirst().pageNumber).toUriString(),
)
else null,
if (!page.isLast) OpdsLinkFeedNavigation(
OpdsLinkRel.NEXT,
pageBuilder.expand(mapOf("page" to page.pageable.next().pageNumber)).toUriString(),
uriBuilder.cloneBuilder().queryParam("page", page.pageable.next().pageNumber).toUriString(),
)
else null,
)
Expand Down

0 comments on commit 288858c

Please sign in to comment.