From 38642a6910b1a58b1f45e0a78fb0764e2d4af1e5 Mon Sep 17 00:00:00 2001 From: wowlikon Date: Sun, 1 Feb 2026 19:28:36 +0300 Subject: [PATCH] =?UTF-8?q?=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20=D0=BF=D0=BE=D1=81?= =?UTF-8?q?=D0=BB=D0=B5=20=D1=82=D1=80=D0=B0=D0=BD=D1=81=D0=BA=D0=BE=D0=B4?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library_service/routers/books.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library_service/routers/books.py b/library_service/routers/books.py index bc271d3..2bfbe4a 100644 --- a/library_service/routers/books.py +++ b/library_service/routers/books.py @@ -324,13 +324,14 @@ async def upload_book_preview( with open(tmp_path, "wb") as f: shutil.copyfileobj(file.file, f) - transcode_image(tmp_path) - book = session.get(Book, book_id) if not book: tmp_path.unlink() raise HTTPException(status.HTTP_404_NOT_FOUND, "Book not found") + transcode_image(tmp_path) + tmp_path.unlink() + if book.preview_id: for path in BOOKS_PREVIEW_DIR.glob(f"{book.preview_id}.*"): if path.exists():