Delete zip file after downloading

This commit is contained in:
2023-02-19 21:26:36 +00:00
parent c850726f91
commit 163ae21b11

View File

@@ -120,4 +120,5 @@ async def download_all(Authorize: AuthJWT = Depends(), session: AsyncSession = D
for path in paths:
zip_file.write(f"{settings.DATA_PATH}/{path}", os.path.basename(path))
return FileResponse(zip_path, media_type="application/zip", filename="signs.zip")
# return the zip file and delete it after the request is done
return FileResponse(zip_path, media_type="application/zip", filename="signs.zip", delete_after_request=True)