From 4295860f7d44cb8b27b502b3396a5f54699bb2ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=BD=AE?= Date: Sat, 28 Feb 2026 11:47:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0skill=20manager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/skill_manager.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/routes/skill_manager.py b/routes/skill_manager.py index 685e7e7..c669f04 100644 --- a/routes/skill_manager.py +++ b/routes/skill_manager.py @@ -112,6 +112,9 @@ def detect_zip_has_top_level_dirs(zip_path: str) -> bool: # 跳过空目录项(以 / 结尾的空路径) if not name or name == '/': continue + # 跳过 macOS 系统文件夹 + if name.startswith('__MACOSX') or name.startswith('.'): + continue # 提取顶级路径(第一层) parts = name.split('/') if parts[0]: # 忽略空字符串 @@ -231,6 +234,9 @@ async def validate_and_rename_skill_folder( if has_top_level_dirs: # zip 包含目录,检查每个目录 for folder_name in os.listdir(extract_dir): + # 跳过 macOS 系统文件夹和隐藏文件夹 + if folder_name.startswith('__MACOSX') or folder_name.startswith('.'): + continue folder_path = os.path.join(extract_dir, folder_name) if os.path.isdir(folder_path): result = await asyncio.to_thread( @@ -678,6 +684,9 @@ async def upload_skill(file: UploadFile = File(...), bot_id: Optional[str] = For if has_top_level_dirs: # 获取所有解压后的 skill 目录 for item in os.listdir(final_extract_path): + # 跳过 macOS 系统文件夹和隐藏文件夹 + if item.startswith('__MACOSX') or item.startswith('.'): + continue item_path = os.path.join(final_extract_path, item) if os.path.isdir(item_path): skill_dirs_to_validate.append(item_path)