Mrs4s / go-cqhttp

cqhttp的golang实现,轻量、原生跨平台.
GNU Affero General Public License v3.0
10.37k stars 1.63k forks source link

[Bug]: 使用[CQ:image]时,路径中包含‘#’符号会导致无法发送 #1435

Closed ghost closed 2 years ago

ghost commented 2 years ago

请确保您已阅读以上注意事项,并勾选下方的确认框。

go-cqhttp 版本

v1.0.0-rc1

运行环境

Windows (64)

运行架构

AMD64

连接方式

WebSocket (正向)

使用协议

0 | iPad

重现步骤

发送消息 [CQ:image,file=file:///F:\a#\a.jpg,cache=1]

期望的结果是什么?

成功发送图片,尝试过将'#'符号替换成实体字符发送 [CQ:image,file=file:///F:\a#\a.jpg,cache=1] 得到的也是转换错误 转换CQ码 [CQ:image,file=file:///F:\a#\a.jpg,cache=1] 时出现错误: file not found 将原样发送.

实际的结果是什么?

转换CQ码 [CQ:image,file=file:///F:\a#\a.jpg,cache=1] 时出现错误: file not found 将原样发送.

简单的复现代码/链接(可选)

No response

日志记录(可选)

No response

补充说明(可选)

No response

ghost commented 2 years ago

期望的结果是什么?中的实体字符被转义了,,,,,我上传图片吧 QQ截图20220321154801

qianjunakasumi commented 2 years ago

成功复现

qianjunakasumi commented 2 years ago

证实由 github.com/Mrs4s/go-cqhttp/tree/dev/coolq/cqcode.go#L1175 引起

ghost commented 2 years ago

证实由 github.com/Mrs4s/go-cqhttp/tree/dev/coolq/cqcode.go#L1175 引起

辛苦了

wdvxdr1123 commented 2 years ago

根据 #1436 的讨论和 onebot标准, 需要对#进行转义(URL转义): # -> %23