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) # 消息类型