feat: 添加消息段冲突检查功能,避免非法请求组合 - #227
Open
Yushu2606 wants to merge 3 commits into
Open
Conversation
Member
|
出现 segment 冲突的时候可以报错,但是不应该主动合并这些消息段,应该由用户在 开发阶段 解决冲突 |
Author
整理了一下当前 pr 里 各段类型的落地字段
单独出现(消息里只有这一种段)
两两组合(C2C / 群聊结果一致,
|
| ↓ × → | text | mention/emoji | md(自由) | md(模板) | ark | keyboard | embed† | media | reference |
|---|---|---|---|---|---|---|---|---|---|
| text | 通过 | 通过 | 报错 | 报错 | 报错 | 报错* | 通过 | 通过 | 通过 |
| mention/emoji | 通过 | 通过 | 合并→markdown | 报错 | 报错 | 报错* | 通过 | 通过 | 通过 |
| md(自由) | 报错 | 合并→markdown | 合并→markdown | 报错 | 报错 | 通过 | 通过 | 报错 | 通过 |
| md(模板) | 报错 | 报错 | 报错 | 报错 | 报错 | 通过 | 通过 | 报错 | 通过 |
| ark | 报错 | 报错 | 报错 | 报错 | 报错 | 报错* | 通过 | 报错 | 通过 |
| keyboard | 报错* | 报错* | 通过 | 通过 | 报错* | 报错 | 报错* | 报错* | 报错* |
| embed† | 通过 | 通过 | 通过 | 通过 | 通过 | 报错* | 报错 | 报错 | 通过 |
| media | 通过 | 通过 | 报错 | 报错 | 报错 | 报错* | 报错 | 报错 | 通过 |
| reference | 通过 | 通过 | 通过 | 通过 | 通过 | 报错* | 通过 | 通过 | 报错 |
对角线=同类型出现 2 个及以上(比如 md(自由)×md(自由) 那格=多个 markdown 段的情况)。
* 不是这两种段本身互斥——是 keyboard(及 C2C 下的 prompt_keyboard/action_button)自己的规则:必须搭配 markdown 段一起用,缺了就报错,跟搭档是谁无关。
† embed 在 C2C/群聊本来就不受官方支持,这次改动没碰它,"通过"只是没被拦,不代表判定为安全。
需要注意的地方
标 合并→markdown 的两格(mention/emoji × markdown(自由)、markdown(自由) × markdown(自由))目前是自动合并。
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.
Closes #215, Closes #225