mirror of
https://github.com/th3r00t/pyShelf.git
synced 2026-04-28 01:59:35 -04:00
Update src/frontend/lib/FastAPIServer.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
4
src/frontend/lib/FastAPIServer.py
vendored
4
src/frontend/lib/FastAPIServer.py
vendored
@@ -222,7 +222,9 @@ class FastAPIServer():
|
|||||||
async def book(request: Request, book_id: int):
|
async def book(request: Request, book_id: int):
|
||||||
storage = Storage(Config(os.path.abspath(os.getcwd())))
|
storage = Storage(Config(os.path.abspath(os.getcwd())))
|
||||||
book = storage.get_book(book_id)
|
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):
|
if not os.path.exists(file_path):
|
||||||
return JSONResponse(status_code=404, content={"error": "File not found"})
|
return JSONResponse(status_code=404, content={"error": "File not found"})
|
||||||
"""Book file responder."""
|
"""Book file responder."""
|
||||||
|
|||||||
Reference in New Issue
Block a user