mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 12:31:23 +00:00
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 <succ985@users.noreply.github.com> Co-authored-by: Gustavo Madeira Santana <gumadeiras@gmail.com>
This commit is contained in:
@@ -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<Buffer> {
|
||||
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);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -42,6 +42,7 @@ const MIME_BY_EXT: Record<string, string> = {
|
||||
|
||||
const AUDIO_FILE_EXTENSIONS = new Set([
|
||||
".aac",
|
||||
".caf",
|
||||
".flac",
|
||||
".m4a",
|
||||
".mp3",
|
||||
|
||||
Reference in New Issue
Block a user