mirror of
https://github.com/vastsa/FileCodeBox.git
synced 2026-11-22 06:57:56 +08:00
fix:文件不存在删除报错
This commit is contained in:
1 parent
0d5e26f752
commit
64f476e6db
1 file changed
+2
-1
+2
-1
@@ -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]
|
||||
|
||||
Reference in new issue
Block a user