From e3d8a31699d2d949036ab325754abc8d3196aeff Mon Sep 17 00:00:00 2001 From: skjnldsv Date: Fri, 18 Sep 2026 08:45:07 +0200 Subject: [PATCH] fix(audios): take the other two names for a WAV A WAV is served as audio/wav by most tooling, as audio/vnd.wave by mail clients (RFC 2361 registered it) and as audio/x-wav by older Windows exports. Only the first was listed, so an attachment arriving as one of the other two was never offered to the handler: Nextcloud Mail filters what it shows against the viewer, and a WAV sent from Thunderbird had no player while an MP3 beside it did. The declared type does not decide what plays. The same file was served under all three names and under application/octet-stream, and Chromium and Firefox played every one of them: a media element reads the bytes. The list is what the viewer offers to open, not what a browser claims. Co-authored-by: Lucas Peters <149142920+ixgate-lpeters@users.noreply.github.com> Assisted-by: ClaudeCode:claude-opus-5 Signed-off-by: skjnldsv --- __tests__/models.spec.ts | 2 ++ lib/models/audios.ts | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/__tests__/models.spec.ts b/__tests__/models.spec.ts index 85aa28f..129e19f 100644 --- a/__tests__/models.spec.ts +++ b/__tests__/models.spec.ts @@ -130,8 +130,10 @@ describe('audios model', () => { 'audio/mpeg', 'audio/ogg', 'audio/vorbis', + 'audio/vnd.wave', 'audio/wav', 'audio/webm', + 'audio/x-wav', ])('enables browser-supported mime %s', async (mime) => { const { registerAudioHandler } = await import('../lib/models/audios.ts') registerAudioHandler() diff --git a/lib/models/audios.ts b/lib/models/audios.ts index ec80e6a..2056099 100644 --- a/lib/models/audios.ts +++ b/lib/models/audios.ts @@ -18,8 +18,13 @@ const browserSupportedMimes = [ 'audio/mpeg', 'audio/ogg', 'audio/vorbis', + // The same RIFF/WAVE container under all three of its names: the one in + // common use, the registered one (RFC 2361) that mail clients send, and the + // historic x- form. What plays is decided by the bytes, not by the name. + 'audio/vnd.wave', 'audio/wav', 'audio/webm', + 'audio/x-wav', ] export const tagname = 'oca-viewer-audio'