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
This commit is contained in:
James Ward
2026-04-22 17:27:09 -04:00
committed by Zach Yale
parent 907ad09d5b
commit 6a9f4cd112
@@ -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.")