From f6a1fc3fef44f064849653d0ac40e019559dc83b Mon Sep 17 00:00:00 2001 From: LIghtJUNction Date: Tue, 30 Jun 2026 14:00:49 +0800 Subject: [PATCH] fix: close update staging temp context --- astrbot/dashboard/services/update_service.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/astrbot/dashboard/services/update_service.py b/astrbot/dashboard/services/update_service.py index c369180c2..84f3cf36f 100644 --- a/astrbot/dashboard/services/update_service.py +++ b/astrbot/dashboard/services/update_service.py @@ -201,12 +201,11 @@ class UpdateService: update_temp_parent.unlink() update_temp_parent.mkdir(mode=0o700, parents=True, exist_ok=True) update_temp_parent.chmod(0o700) - update_temp_dir_obj = tempfile.TemporaryDirectory( + with tempfile.TemporaryDirectory( prefix="project-update-", dir=update_temp_parent, - ) - try: - update_temp_dir = Path(update_temp_dir_obj.name) + ) as update_temp_dir_name: + update_temp_dir = Path(update_temp_dir_name) update_token = uuid.uuid4().hex dashboard_zip_path = update_temp_dir / f"{update_token}-dashboard.zip" core_zip_path = update_temp_dir / f"{update_token}-core.zip"