From 64f476e6dbb95837239fded5acc8f417efaa474a Mon Sep 17 00:00:00 2001 From: lan Date: Thu, 22 Dec 2022 20:15:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=96=87=E4=BB=B6=E4=B8=8D=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E5=88=A0=E9=99=A4=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- storage.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage.py b/storage.py index 8caf08d..40b4cdc 100644 --- a/storage.py +++ b/storage.py @@ -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]