Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

富文本 content 未转义导致 cqhttp 客户端可能产生解析问题 #26

Closed
zkonge opened this issue Aug 6, 2020 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@zkonge
Copy link

zkonge commented Aug 6, 2020

https://github.com/yyuueexxiinngg/cqhttp-mirai/blob/e681eeddce41442d099eb46aa5a39a9432587c24/src/main/kotlin/tech/mihoyo/mirai/data/common/MessageDTO.kt#L79

content 可能包含 [, ], , 等字符,cqhttp客户端解析时会出现一些问题(比如 QQ 的小程序传来的就是一个 json,里面的逗号会干扰 CQ 码解析)

修复建议:转义

同时建议排查处理 Message.toCQString() 中其他类型的消息,同样可能包含需要转义的字符

https://github.com/yyuueexxiinngg/cqhttp-mirai/blob/4c96097a71b4a9c78bf6057b55a2b537c1ec2fbe/src/main/kotlin/tech/mihoyo/mirai/util/CQMessgeParser.kt#L270
(吐槽:这里写了没用上吗

@yyuueexxiinngg yyuueexxiinngg added the bug Something isn't working label Aug 7, 2020
@yyuueexxiinngg
Copy link
Owner

确实没考虑到转义问题
(后面代码是抄来的...捂脸

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants