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, },