mirror of
https://github.com/wowlikon/LiB.git
synced 2026-02-04 04:31:09 +00:00
удаление файла после транскодирования
This commit is contained in:
@@ -324,13 +324,14 @@ async def upload_book_preview(
|
|||||||
with open(tmp_path, "wb") as f:
|
with open(tmp_path, "wb") as f:
|
||||||
shutil.copyfileobj(file.file, f)
|
shutil.copyfileobj(file.file, f)
|
||||||
|
|
||||||
transcode_image(tmp_path)
|
|
||||||
|
|
||||||
book = session.get(Book, book_id)
|
book = session.get(Book, book_id)
|
||||||
if not book:
|
if not book:
|
||||||
tmp_path.unlink()
|
tmp_path.unlink()
|
||||||
raise HTTPException(status.HTTP_404_NOT_FOUND, "Book not found")
|
raise HTTPException(status.HTTP_404_NOT_FOUND, "Book not found")
|
||||||
|
|
||||||
|
transcode_image(tmp_path)
|
||||||
|
tmp_path.unlink()
|
||||||
|
|
||||||
if book.preview_id:
|
if book.preview_id:
|
||||||
for path in BOOKS_PREVIEW_DIR.glob(f"{book.preview_id}.*"):
|
for path in BOOKS_PREVIEW_DIR.glob(f"{book.preview_id}.*"):
|
||||||
if path.exists():
|
if path.exists():
|
||||||
|
|||||||
Reference in New Issue
Block a user