From ccdbb01513d4a8f4ee9fe1d72e43f8565bb098b8 Mon Sep 17 00:00:00 2001 From: Raven95676 Date: Tue, 6 May 2025 18:39:11 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BF=AE=E6=94=B9move=E4=B8=BAcopy?= =?UTF-8?q?=EF=BC=8Cclean=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/cli/utils/plugin.py | 2 +- astrbot/core/message/components.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/astrbot/cli/utils/plugin.py b/astrbot/cli/utils/plugin.py index 334e18da3..dcb10385a 100644 --- a/astrbot/cli/utils/plugin.py +++ b/astrbot/cli/utils/plugin.py @@ -252,7 +252,7 @@ def manage_plugin( if is_update and backup_path.exists(): shutil.rmtree(backup_path) if is_update: - shutil.move(target_path, backup_path) + shutil.copytree(target_path, backup_path) try: click.echo( diff --git a/astrbot/core/message/components.py b/astrbot/core/message/components.py index 08d7b8693..55722c0ee 100644 --- a/astrbot/core/message/components.py +++ b/astrbot/core/message/components.py @@ -374,7 +374,6 @@ class Image(BaseMessageComponent): bs64_data = url.removeprefix("base64://") image_bytes = base64.b64decode(bs64_data) temp_dir = os.path.join(get_astrbot_data_path(), "temp") - os.makedirs(temp_dir, exist_ok=True) image_file_path = os.path.join(temp_dir, f"{uuid.uuid4()}.jpg") with open(image_file_path, "wb") as f: f.write(image_bytes)