From de77a36579592d7f5d960d588f1dc6302e426d7e Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 2 Mar 2026 23:30:48 +0000 Subject: [PATCH] test: harden MIME normalization regression coverage (#32280) (thanks @Lucenx9) --- CHANGELOG.md | 1 + src/media/mime.test.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 019bf9029..1781d04a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ Docs: https://docs.openclaw.ai - macOS/LaunchAgent security defaults: write `Umask=63` (octal `077`) into generated gateway launchd plists so post-update service reinstalls keep owner-only file permissions by default instead of falling back to system `022`. (#32022) Fixes #31905. Thanks @liuxiaopai-ai. - Plugin SDK/runtime hardening: add package export verification in CI/release checks to catch missing runtime exports before publish-time regressions. (#28575) Thanks @Glucksberg. - Media understanding/provider HTTP proxy routing: pass a proxy-aware fetch function from `HTTPS_PROXY`/`HTTP_PROXY` env vars into audio/video provider calls (with graceful malformed-proxy fallback) so transcription/video requests honor configured outbound proxies. (#27093) Thanks @mcaxtr. +- Media/MIME normalization: normalize parameterized/case-variant MIME strings in `kindFromMime` (for example `Audio/Ogg; codecs=opus`) so WhatsApp voice notes are classified as audio and routed through transcription correctly. (#32280) Thanks @Lucenx9. - Media understanding/malformed attachment guards: harden attachment selection and decision summary formatting against non-array or malformed attachment payloads to prevent runtime crashes on invalid inbound metadata shapes. (#28024) Thanks @claw9267. - Media understanding/parakeet CLI output parsing: read `parakeet-mlx` transcripts from `--output-dir/.txt` when txt output is requested (or default), with stdout fallback for non-txt formats. (#9177) Thanks @mac-110. - Media understanding/audio transcription guard: skip tiny/empty audio files (<1024 bytes) before provider/CLI transcription to avoid noisy invalid-audio failures and preserve clean fallback behavior. (#8388) Thanks @Glucksberg. diff --git a/src/media/mime.test.ts b/src/media/mime.test.ts index 2042ac8b8..3fd287331 100644 --- a/src/media/mime.test.ts +++ b/src/media/mime.test.ts @@ -6,6 +6,7 @@ import { extensionForMime, imageMimeFromFormat, isAudioFileName, + kindFromMime, normalizeMimeType, } from "./mime.js"; @@ -131,4 +132,8 @@ describe("mediaKindFromMime", () => { ] as const)("classifies $mime", ({ mime, expected }) => { expect(mediaKindFromMime(mime)).toBe(expected); }); + + it("normalizes MIME strings before kind classification", () => { + expect(kindFromMime(" Audio/Ogg; codecs=opus ")).toBe("audio"); + }); });