From 62bf00edd0b03bf4e74e1ae10aa95e164001a627 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sat, 17 Oct 2026 01:58:57 +0800 Subject: [PATCH] refactor(wechat): document successful decrypt payload contract --- app/modules/wechat/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/modules/wechat/__init__.py b/app/modules/wechat/__init__.py index 28bc386cb..59fd109e2 100644 --- a/app/modules/wechat/__init__.py +++ b/app/modules/wechat/__init__.py @@ -162,7 +162,8 @@ class WechatModule(_MessageChannelModuleBase[WeChat]): 1 """ - dom_tree = xml.dom.minidom.parseString(sMsg.decode('UTF-8')) + # DecryptMsg 的成功分支只返回解密后的 bytes,失败分支已在上方返回。 + dom_tree = xml.dom.minidom.parseString(cast(bytes, sMsg).decode('UTF-8')) # parseString 成功即有根元素;空文档会在解析阶段抛错。 root_node = cast(xml.dom.minidom.Element, dom_tree.documentElement) # 消息类型