fix:文件不存在删除报错

This commit is contained in:
lan
2022-12-22 20:15:04 +08:00
parent ca69797120
commit cadae54c2f
+2 -1
View File
@@ -49,7 +49,8 @@ class FileSystemStorage:
async def delete_file(self, text: str):
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):
tasks = [self.delete_file(text) for text in texts]