From 6a9f4cd112a2fd6d70867bb37fb0132de5bb53ab Mon Sep 17 00:00:00 2001 From: James Ward Date: Wed, 8 Apr 2026 15:06:15 -0400 Subject: [PATCH] fix(api): invert kobo book type check for downloads (#432) * fix(api): invert kobo book type check for downloads with the previous organization of code paths this leads to an exception being raised in the logs even though the response message is fine * style: drop extra newline --- .../main/java/org/booklore/controller/KoboController.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/booklore-api/src/main/java/org/booklore/controller/KoboController.java b/booklore-api/src/main/java/org/booklore/controller/KoboController.java index 3e4f58823..f5cda9f14 100644 --- a/booklore-api/src/main/java/org/booklore/controller/KoboController.java +++ b/booklore-api/src/main/java/org/booklore/controller/KoboController.java @@ -174,11 +174,11 @@ public class KoboController { @ApiResponse(responseCode = "200", description = "Book downloaded successfully") @GetMapping("/v1/books/{bookId}/download") public void downloadBook(@Parameter(description = "Book ID") @PathVariable String bookId, HttpServletResponse response) { - if (StringUtils.isNumeric(bookId)) { - bookDownloadService.downloadKoboBook(Long.parseLong(bookId), response); + if (!StringUtils.isNumeric(bookId)) { + throw ApiError.GENERIC_NOT_FOUND.createException("Not Found"); } - throw ApiError.GENERIC_NOT_FOUND.createException("Not Found"); + bookDownloadService.downloadKoboBook(Long.parseLong(bookId), response); } @Operation(summary = "Delete book from Kobo library", description = "Delete a book from the user's Kobo library.")