mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
refactor(media): collapse attachment byte classification into media-core (#122168)
Attachment MIME gating and extraction dispatch used nine separate byte policies across five files; the allowlist could approve one MIME while dispatch observed another after a second sniff. @openclaw/media-core/attachment-classify now owns byte sniffing, text heuristics, extension mapping, and the seven attachment classes; the cache stores one classification that gates and dispatch share. Channel-declared MIME leads with the transport Content-Type as a byte-arbitrated hint, normalizeMimeType folds YAML/XML synonyms so existing configured allowlists keep matching, and input_file API callers keep declared-MIME precedence over cosmetic filenames. Net -135 production LOC. Proof: 2,153 focused tests across media-core/media-understanding/media plus boundary-contract and deadcode-mirror suites; ClawSweeper local review clean (round 5, zero findings); live Telegram default-turn probe green. Co-authored-by: Ayaan Zaidi <hi@obviy.us>
This commit is contained in:
@@ -602,6 +602,7 @@ const config = {
|
||||
"packages/media-core": {
|
||||
entry: [
|
||||
"src/index.ts!",
|
||||
"src/attachment-classify.ts!",
|
||||
"src/base64.ts!",
|
||||
"src/constants.ts!",
|
||||
"src/content-length.ts!",
|
||||
|
||||
Reference in New Issue
Block a user