From 313a6d8a248df549362aeea696db04a5b258c9e4 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sun, 1 Feb 2026 18:12:40 +0800 Subject: [PATCH] fix: improve error handling for temporary file removal in FileDownloadTool --- astrbot/core/computer/tools/fs.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/astrbot/core/computer/tools/fs.py b/astrbot/core/computer/tools/fs.py index 47f130700..b6823c122 100644 --- a/astrbot/core/computer/tools/fs.py +++ b/astrbot/core/computer/tools/fs.py @@ -182,11 +182,11 @@ class FileDownloadTool(FunctionTool): except Exception as e: logger.error(f"Error sending file message: {e}") - # remove - try: - os.remove(local_path) - except Exception as e: - logger.error(f"Error removing temp file {local_path}: {e}") + # remove + try: + os.remove(local_path) + except Exception as e: + logger.error(f"Error removing temp file {local_path}: {e}") return f"File downloaded successfully to {local_path}" except Exception as e: