From bc4b1e394d94e092711dc2e022ecb366135fd18a Mon Sep 17 00:00:00 2001 From: coming Date: Wed, 27 Sep 2023 17:04:19 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9BFix:=20=E5=8C=85=E5=90=AB<>?= =?UTF-8?q?=E7=9A=84=E6=96=87=E5=AD=97=E8=A2=AB=E8=AF=AF=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E4=B8=BA=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wechatbot_client/wechat/adapter.py | 4 ++-- wechatbot_client/wechat/wechat.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wechatbot_client/wechat/adapter.py b/wechatbot_client/wechat/adapter.py index f27afc2..6542acf 100644 --- a/wechatbot_client/wechat/adapter.py +++ b/wechatbot_client/wechat/adapter.py @@ -317,12 +317,12 @@ def json_to_action(cls, json_data: Any) -> Optional[ActionRequest]: try: action = ActionRequest.parse_obj(json_data) except ValidationError: - log("ERROR", f"action请求错误: {json_data}") + log("ERROR", f"action请求错误: {escape_tag(format(json_data))}") return None logstring = str(action.dict()) if len(logstring) > 200: logstring = logstring[:200] + "..." - log("SUCCESS", f"收到action请求: {logstring}") + log("SUCCESS", f"收到action请求: {escape_tag(logstring)}") return action @classmethod diff --git a/wechatbot_client/wechat/wechat.py b/wechatbot_client/wechat/wechat.py index 4589ab5..a2f1e1f 100644 --- a/wechatbot_client/wechat/wechat.py +++ b/wechatbot_client/wechat/wechat.py @@ -24,7 +24,7 @@ StatusUpdateEvent, ) from wechatbot_client.typing import overrides -from wechatbot_client.utils import logger_wrapper +from wechatbot_client.utils import logger_wrapper, escape_tag from .adapter import Adapter @@ -167,5 +167,5 @@ async def handle_evnt_msg(self, msg: Message) -> None: if event is None: log("DEBUG", "未生成合适事件") return - log("SUCCESS", f"生成事件[{event.__repr_name__()}]:{event.dict()}") + log("SUCCESS", f"生成事件[{event.__repr_name__()}]:{escape_tag(format(event.dict()))}") await self.handle_event(event)