fix: 移出精华消息时 msg_random 与 msg_seq 参数顺序错误 - #2064
Merged
Merged
Conversation
📦 构建产物
📋 构建信息
🚀 快速安装 (Linux)直连(需要能访问 GitHub) curl -sSL https://github.com/NapNeko/napcat-pr-release/releases/download/pr-2064-f8c3851/install.sh | bash加速(国内推荐,ghfast.top) curl -sSL https://gh.llkk.cc/https://github.com/NapNeko/napcat-pr-release/releases/download/pr-2064-f8c3851/install.sh | bash
|
📋 构建信息
🚀 快速使用拉取镜像 docker pull mlikiowa/napcat-docker:pr-2064-f8c3851启动容器 docker run -d \
--name napcat-pr-test \
-e NAPCAT_UID=$(id -u) \
-e NAPCAT_GID=$(id -g) \
-e WEBUI_TOKEN=napcat \
-p 6099:6099 \
-p 3000:3000 \
-p 3001:3001 \
-v ./napcat/config:/app/napcat/config \
-v ./napcat/QQ:/app/.config/QQ \
mlikiowa/napcat-docker:pr-2064-f8c3851
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
delete_essence_msg的essenceLRU兜底分支把msg_seq和msg_random传反了:GroupApi.removeGroupEssenceBySeq的签名是(groupCode, msgRandom, msgSeq)(packages/napcat-core/apis/group.ts:413),本文件上方直接传参的分支(34-38 行)也是(group_id, msg_random, msg_seq),只有兜底分支顺序相反。复现路径:
get_essence_msg_list;当某条精华消息已无法从本地消息缓存解析时,接口会返回 md5 生成的合成message_id,并把{msg_seq, msg_random, group_id}写入GroupApi.essenceLRU(GetGroupEssence.ts:89-100);message_id调用delete_essence_msg;MessageUnique.getMsgIdAndPeerByShortId未命中 → 命中essenceLRU→ 第 51 行把 msgRandom 与 msgSeq 对调后发给服务端,移出精华失败。也就是说,这个分支本身就是为「用列表返回的 message_id 移出精华」准备的,却恰好在该流程里传参错误。
修复
按
removeGroupEssenceBySeq(groupCode, msgRandom, msgSeq)的实际签名修正参数顺序。验证
pnpm test(vitest):181 passed;新增packages/napcat-test/delEssenceMsg.test.ts2 个用例,覆盖显式传参分支与 essenceLRU 兜底分支['33','11','22'],期望['33','22','11']eslint .通过tsc --noEmit --skipLibCheck全部通过