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.")