удаление файла после транскодирования

This commit is contained in:
2026-02-01 19:28:36 +03:00
parent d442a37820
commit 38642a6910
+3 -2
View File
@@ -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():