From 19b9a5d8da12afb43a0b32fc81a81f6e80fc11c5 Mon Sep 17 00:00:00 2001 From: hp0912 <809211365@qq.com> Date: Sat, 6 Jun 2026 16:35:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E8=A1=A8=E6=83=85?= =?UTF-8?q?=E5=8C=85=E5=8F=82=E6=95=B0=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- skills/send-emoji/scripts/send_emoji.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/skills/send-emoji/scripts/send_emoji.py b/skills/send-emoji/scripts/send_emoji.py index 2898446..d5d7c6a 100644 --- a/skills/send-emoji/scripts/send_emoji.py +++ b/skills/send-emoji/scripts/send_emoji.py @@ -75,8 +75,13 @@ def _expand_json_array_values(values: list[str], label: str) -> list[str]: stripped = value.strip() if not stripped: continue - if stripped.startswith("["): - parsed = json.loads(stripped) + if stripped.startswith("[") and stripped.endswith("]"): + try: + parsed = json.loads(stripped) + except json.JSONDecodeError: + # 不是合法 JSON(例如 [开心]),当作普通名称 + expanded.append(stripped) + continue if not isinstance(parsed, list): raise ValueError(f"{label} 必须是字符串数组") for item in parsed: