Skip to content

[Bug]: 在频道中发送的图片在qq客户端上尺寸变成了正方形(原图不是正方形) #10

@ConsetHP

Description

@ConsetHP

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

  • 我已经仔细阅读上述教程和 "提问前需知"
  • 我已经使用 dev分支版本 测试过,问题依旧存在。
  • 我已经在 Issue Tracker 中找过我要提出的问题,没有找到相同问题的ISSUE。
  • 我已知晓并同意,此处仅用于汇报程序中存在的问题。若这个 Issue 是关于其他非程序本身问题,则我的 Issue 可能会被无条件自动关闭或/并锁定。(这些问题应当在 Discussion 板块提出。)

go-cqhttp 版本

v1.3.1-pre-7

运行环境

Ubuntu

运行架构

AMD64

连接方式

WebSocket (反向)

使用协议

6 | aPad

重现步骤

将bot账号拉入频道,让bot随便发一张图片
比如这张:

Image

期望的结果是什么?

正常发送图片,且客户端中显示的图片尺寸正常

实际的结果是什么?

部分图片发送失败
cqhttp日志中报错:

[WARNING]: Protocol -> warning: decode image error: <nil>. this image will be displayed by wrong size in pc guild client
[INFO]: 发送频道 测试频道(114514) 子频道 测试(114514) 的消息: [{"type":  ... (16310-2706822233)
[ERROR]: 处置WS命令时发生无法恢复的异常:runtime error: invalid memory address or nil pointer dereference
goroutine 5619 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:24 +0x65
github.com/ProtocolScience/AstralGocq/server.(*wsConn).handleRequest.func1()
        github.com/ProtocolScience/AstralGocq/server/websocket.go:472 +0x46
panic({0xa686a0, 0xfd0190})
        runtime/panic.go:884 +0x213
github.com/ProtocolScience/AstralGo/client.(*GuildService).SendGuildChannelMessage(0xc00051c8c0, 0x65cb37725e88ac, 0x17f54388, 0xc000173700)
        github.com/ProtocolScience/AstralGo@v0.0.0-20250227094640-e471bfb19ec7/client/guild_msg.go:68 +0x47d
github.com/ProtocolScience/AstralGocq/coolq.(*CQBot).SendGuildChannelMessage(0xc00057f580, 0x1?, 0xd0?, 0xc000173700)
        github.com/ProtocolScience/AstralGocq/coolq/bot.go:447 +0x371
github.com/ProtocolScience/AstralGocq/coolq.(*CQBot).CQSendGuildChannelMessage(0xc00057f580, 0x65cb37725e88ac, 0x17f54388, {0x5, {0xc00025a077, 0xd0}, {0x0, 0x0}, 0x0, 0x77, ....)
        github.com/ProtocolScience/AstralGocq/coolq/api.go:827 +0x5ce
github.com/ProtocolScience/AstralGocq/modules/api.(*Caller).call(0xc000331120, {0xc00025a00c, 0x16?}, 0xfd1fe0, {0xc24aa0, 0xc0000a0aa0})
        github.com/ProtocolScience/AstralGocq/modules/api/api.go:283 +0xb30d
github.com/ProtocolScience/AstralGocq/modules/api.(*Caller).Call(0xc000331120, {0xc00025a00c, 0x16}, 0xc00025a000?, {0xc24aa0, 0xc0000a0aa0})
        github.com/ProtocolScience/AstralGocq/modules/api/caller.go:35 +0xc5
github.com/ProtocolScience/AstralGocq/server.(*wsConn).handleRequest(0xc0004c4270, 0xc27c28?, {0xc00025a000?, 0x0?, 0xc0000b0c80?})
        github.com/ProtocolScience/AstralGocq/server/websocket.go:481 +0x41c
github.com/ProtocolScience/AstralGocq/server.(*websocketClient).listenAPI.func2(0xc0000c6580?)
        github.com/ProtocolScience/AstralGocq/server/websocket.go:326 +0x95
created by github.com/ProtocolScience/AstralGocq/server.(*websocketClient).listenAPI
        github.com/ProtocolScience/AstralGocq/server/websocket.go:324 +0x1b2

多次尝试发送该图片后会导致bot被踢下线:
[WARNING]: Bot已离线: 服务端强制下线.
发送失败的图片是bytes类型的
示例图片(类型为BytesIO)可以正常发送,但是cqhttp日志中依旧报错:decode image error。客户端上看见的效果:

Image

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

日志记录(可选)

补充说明(可选)

之前使用的cqhttp是几个月前从这里中发布的链接下载的,当时下载的版本可以正常发送图片,且日志中从未出现过:
[WARNING]: Protocol -> warning: decode image error: <nil>. this image will be displayed by wrong size in pc guild client
在尝试将cqhttp更换为这个仓库的最新版本后就立刻出现了这个问题

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions