From b8f740fb148cce8e56191114c583859b6393bf61 Mon Sep 17 00:00:00 2001 From: succ985 <3186520056@qq.com> Date: Sun, 8 Feb 2026 07:04:22 +0800 Subject: [PATCH] fix: add .caf to AUDIO_FILE_EXTENSIONS (#10982) * fix: add .caf to AUDIO_FILE_EXTENSIONS for iMessage voice messages * fix: add caf audio extension regression coverage (#10982) (thanks @succ985) --------- Co-authored-by: succ985 Co-authored-by: Gustavo Madeira Santana --- CHANGELOG.md | 1 + src/media/mime.test.ts | 16 +++++++++++++++- src/media/mime.ts | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62ab432f8..c2e71dbc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ Docs: https://docs.openclaw.ai - Cron: scheduler reliability (timer drift, restart catch-up, lock contention, stale running markers). (#10776) Thanks @tyler6204. - Cron: store migration hardening (legacy field migration, parse error handling, explicit delivery mode persistence). (#10776) Thanks @tyler6204. - Memory: set Voyage embeddings `input_type` for improved retrieval. (#10818) Thanks @mcinteerj. +- Media understanding: recognize `.caf` audio attachments for transcription. (#10982) Thanks @succ985. - Telegram: auto-inject DM topic threadId in message tool + subagent announce. (#7235) Thanks @Lukavyi. - Security: require auth for Gateway canvas host and A2UI assets. (#9518) Thanks @coygeek. - Cron: fix scheduling and reminder delivery regressions; harden next-run recompute + timer re-arming + legacy schedule fields. (#9733, #9823, #9948, #9932) Thanks @tyler6204, @pycckuu, @j2h4u, @fujiwara-tofu-shop. diff --git a/src/media/mime.test.ts b/src/media/mime.test.ts index df9f9c4f0..9798e1f5e 100644 --- a/src/media/mime.test.ts +++ b/src/media/mime.test.ts @@ -1,6 +1,6 @@ import JSZip from "jszip"; import { describe, expect, it } from "vitest"; -import { detectMime, extensionForMime, imageMimeFromFormat } from "./mime.js"; +import { detectMime, extensionForMime, imageMimeFromFormat, isAudioFileName } from "./mime.js"; async function makeOoxmlZip(opts: { mainMime: string; partPath: string }): Promise { const zip = new JSZip(); @@ -96,3 +96,17 @@ describe("extensionForMime", () => { expect(extensionForMime(undefined)).toBeUndefined(); }); }); + +describe("isAudioFileName", () => { + it("matches known audio extensions", () => { + const cases = [ + { fileName: "voice.mp3", expected: true }, + { fileName: "voice.caf", expected: true }, + { fileName: "voice.bin", expected: false }, + ] as const; + + for (const testCase of cases) { + expect(isAudioFileName(testCase.fileName)).toBe(testCase.expected); + } + }); +}); diff --git a/src/media/mime.ts b/src/media/mime.ts index 154bd3ba4..7d0296d23 100644 --- a/src/media/mime.ts +++ b/src/media/mime.ts @@ -42,6 +42,7 @@ const MIME_BY_EXT: Record = { const AUDIO_FILE_EXTENSIONS = new Set([ ".aac", + ".caf", ".flac", ".m4a", ".mp3",