From 93b4c19ef8fdcaa4becb5bf22c58428ba546a256 Mon Sep 17 00:00:00 2001 From: th3r00t Date: Mon, 11 Aug 2025 12:31:07 -0400 Subject: [PATCH] Update src/frontend/lib/FastAPIServer.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/frontend/lib/FastAPIServer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/frontend/lib/FastAPIServer.py b/src/frontend/lib/FastAPIServer.py index da9cbc3..a9210c1 100644 --- a/src/frontend/lib/FastAPIServer.py +++ b/src/frontend/lib/FastAPIServer.py @@ -222,7 +222,9 @@ class FastAPIServer(): async def book(request: Request, book_id: int): storage = Storage(Config(os.path.abspath(os.getcwd()))) book = storage.get_book(book_id) - file_path = book[0].file_name + if book is None: + return JSONResponse(status_code=404, content={"error": "Book not found"}) + file_path = book.file_name if not os.path.exists(file_path): return JSONResponse(status_code=404, content={"error": "File not found"}) """Book file responder."""