From 08d302b22c57ee07ab9889750a4e2496002a7767 Mon Sep 17 00:00:00 2001 From: teddy Date: Thu, 21 Aug 2025 15:28:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(sendmsg):=20=E4=BF=AE=E5=A4=8D=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=B7=AF=E5=BE=84=E6=A3=80=E6=9F=A5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 合并文件路径和文件存在性检查为单一条件,确保在文件路径有效时才进行后续操作。 --- sendmsg.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sendmsg.py b/sendmsg.py index 10c454c..cf52615 100644 --- a/sendmsg.py +++ b/sendmsg.py @@ -90,8 +90,7 @@ def send_daily_message(count): print(f"找到了{format}格式的图片文件!") break - if file_path: - if os.path.isfile(file_path): + if file_path and os.path.isfile(file_path): logger.info("找到了指定文件!") logger.info(f"文件大小: {os.path.getsize(file_path)} 字节")