From 0674371536f6685dcb18b7554bdc295e6bf82b6a Mon Sep 17 00:00:00 2001 From: Z8MB1E Date: Mon, 7 Sep 2026 00:52:26 -0400 Subject: [PATCH] fix(voiceover): strip codec parameters from uploaded recording mimetype --- src/app/(frontend)/voiceover/actions.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/(frontend)/voiceover/actions.ts b/src/app/(frontend)/voiceover/actions.ts index 7643316..5b6da2f 100644 --- a/src/app/(frontend)/voiceover/actions.ts +++ b/src/app/(frontend)/voiceover/actions.ts @@ -87,7 +87,10 @@ export async function submitVoiceRecording( if (!(file instanceof File)) { return { success: false, error: "No audio file provided." }; } - if (!file.type.startsWith("audio/")) { + // Browsers report MediaRecorder blobs as e.g. "audio/webm;codecs=opus" — + // strip parameters so the base type matches the collection allowlist. + const mimetype = file.type.split(";")[0]?.trim().toLowerCase() ?? ""; + if (!mimetype.startsWith("audio/")) { return { success: false, error: "Only audio files can be submitted." }; } if (file.size > MAX_AUDIO_BYTES) { @@ -103,7 +106,7 @@ export async function submitVoiceRecording( }, file: { data: Buffer.from(await file.arrayBuffer()), - mimetype: file.type, + mimetype, name: file.name, size: file.size, },