- 新增 internal/channel/mediafetch:来源白名单(deny-by-default,支持 *.suffix) + 逐跳重定向校验 + 边读边限 + 超时;只回来源主机,绝不回完整 URL - 四渠道各自 media.go 接通入站内联:只从平台载荷给出的引用取回字节 (telegram file_id→getFile→file_path 形态校验;kook CDN;qq 文件段 url; weixin cdnURL + AES-ECB 解密) - 常量全部复用既有来源:documents.ExtAllowed / DefaultMaxBytes / MaxPerMessage - channelbridge 诚实提示文案改为对「渠道只给远程引用」与「代取失败」两种成因都成立 - 18 个测试函数(含四渠道「正文里的 URL ⇒ 0 次命中」红线反证、端到端进模型可见视图) - 变异验证:去掉尺寸上限 ⇒ 四渠道红(含修正后不再是假绿的 weixin 超量用例)
21 lines
928 B
Go
21 lines
928 B
Go
package telegram
|
|
|
|
import "errors"
|
|
|
|
// Sentinel errors returned by the Telegram adapter. Consumers test for them
|
|
// with errors.Is; failures that mean "not connected" wrap adapter.ErrNotConnected
|
|
// so the shared channel sentinel still matches.
|
|
var (
|
|
// ErrMissingToken is returned when no BotToken is configured.
|
|
ErrMissingToken = errors.New("telegram: missing bot token")
|
|
// ErrBadResponse is returned when the Bot API replies with OK=false or an
|
|
// unexpected payload shape.
|
|
ErrBadResponse = errors.New("telegram: bad bot api response")
|
|
// ErrNoChatTarget is returned when an outbound message carries no usable
|
|
// conversation/group identifier.
|
|
ErrNoChatTarget = errors.New("telegram: message has no target chat")
|
|
// ErrNoFilePath is returned when getFile yields no usable file_path (empty
|
|
// or a path shape we refuse to splice into a download URL).
|
|
ErrNoFilePath = errors.New("telegram: file path unavailable")
|
|
)
|