mirror of
https://github.com/flibusta-apps/books_downloader.git
synced 2025-12-06 15:05:37 +01:00
Fix removing temp file after unzip
This commit is contained in:
@@ -148,9 +148,11 @@ class FLDownloader(BaseDownloader):
|
|||||||
await temp_file.seek(0)
|
await temp_file.seek(0)
|
||||||
|
|
||||||
async def _unzip(self, response: httpx.Response) -> Optional[str]:
|
async def _unzip(self, response: httpx.Response) -> Optional[str]:
|
||||||
async with asynctempfile.NamedTemporaryFile(delete=False) as temp_file:
|
async with asynctempfile.NamedTemporaryFile(delete=True) as temp_file:
|
||||||
await self._write_response_content_to_ntf(temp_file, response)
|
await self._write_response_content_to_ntf(temp_file, response)
|
||||||
|
|
||||||
|
await temp_file.flush()
|
||||||
|
|
||||||
return await asyncio.get_event_loop().run_in_executor(
|
return await asyncio.get_event_loop().run_in_executor(
|
||||||
process_pool_executor, unzip, temp_file.name, "fb2"
|
process_pool_executor, unzip, temp_file.name, "fb2"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user