File tree 1 file changed +10
-3
lines changed
komga/src/main/kotlin/org/gotson/komga/interfaces/api/kobo
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -503,13 +503,20 @@ class KoboController(
503
503
@PathVariable quality : String? ,
504
504
@PathVariable isGreyScale : String? ,
505
505
): ResponseEntity <Any > =
506
- if (! bookRepository.existsById(bookId) && koboProxy.isEnabled())
506
+ if (! bookRepository.existsById(bookId) && koboProxy.isEnabled()) {
507
507
ResponseEntity
508
508
.status(HttpStatus .TEMPORARY_REDIRECT )
509
509
.location(UriComponentsBuilder .fromHttpUrl(koboProxy.imageHostUrl).buildAndExpand(bookId, width, height).toUri())
510
510
.build()
511
- else
512
- ResponseEntity .ok(bookLifecycle.getThumbnailBytes(bookId)?.bytes ? : throw ResponseStatusException (HttpStatus .NOT_FOUND ))
511
+ } else {
512
+ val poster = bookLifecycle.getThumbnailBytes(bookId) ? : throw ResponseStatusException (HttpStatus .NOT_FOUND )
513
+ val posterBytes =
514
+ if (poster.mediaType != ImageType .JPEG .mediaType)
515
+ imageConverter.convertImage(poster.bytes, ImageType .JPEG .imageIOFormat)
516
+ else
517
+ poster.bytes
518
+ ResponseEntity .ok(posterBytes)
519
+ }
513
520
514
521
@RequestMapping(
515
522
value = [" {*path}" ],
You can’t perform that action at this time.
0 commit comments