-
Notifications
You must be signed in to change notification settings - Fork 997
Open
Labels
Description
-
对 Bug 的描述
- 当前行为:
发送的字符串服务器收到的信息为
<xml> <ToUserName><![CDATA[gh_***]]></ToUserName>\n <FromUserName><![CDATA[opid***]]></FromUserName>\n <CreateTime>1551481349</CreateTime>\n <MsgType><![CDATA[text]]></MsgType>\n <Content><![CDATA[ \x1dc]]></Content>\n <MsgId>22211872600753510</MsgId>\n <Encrypt><![CDATA[***]]></Encrypt>\n </xml>
发送该内容后,无法解析这个xml,导致前端会出现公众号故障的提示 - 正确的行为:正常解析,并返回内容
- 当前行为:
-
环境
- 平台:centos7
- WeRoBot 版本号:1.8.0
- Python 版本:3.6.2
-
复现代码或 repo 链接
from werobot import WeRoBot
def parse_message(
self, body, timestamp=None, nonce=None, msg_signature=None
):
"""
解析获取到的 Raw XML ,如果需要的话进行解密,返回 WeRoBot Message。
:param body: 微信服务器发来的请求中的 Body。
:return: WeRoBot Message
"""
logger.debug(body)
message_dict = parse_xml(body)
if "Encrypt" in message_dict:
xml = self.crypto.decrypt_message(
timestamp=timestamp,
nonce=nonce,
msg_signature=msg_signature,
encrypt_msg=message_dict["Encrypt"]
)
message_dict = parse_xml(xml)
return process_message(message_dict)
# 请在这里给出 bug 的复现代码。如有必要,可以创建一个复现 repo 并将链接粘贴到这里。-
复现步骤
-
其他信息