fix:文件不存在删除报错
This commit is contained in:
+2
-1
@@ -49,7 +49,8 @@ class FileSystemStorage:
|
|||||||
|
|
||||||
async def delete_file(self, text: str):
|
async def delete_file(self, text: str):
|
||||||
filepath = await self.get_filepath(text)
|
filepath = await self.get_filepath(text)
|
||||||
await asyncio.to_thread(os.remove, filepath)
|
if filepath.exists():
|
||||||
|
await asyncio.to_thread(os.remove, filepath)
|
||||||
|
|
||||||
async def delete_files(self, texts):
|
async def delete_files(self, texts):
|
||||||
tasks = [self.delete_file(text) for text in texts]
|
tasks = [self.delete_file(text) for text in texts]
|
||||||
|
|||||||
Reference in New Issue
Block a user