From 18393c0f4e38aca25fad188d0d5808b5d98bcd25 Mon Sep 17 00:00:00 2001 From: Daenney Date: Fri, 27 Dec 2024 18:30:24 +0100 Subject: [PATCH] [bugfix] Advertise audio/mpeg as supported This will be either an mp1, mp2 or mp3 file. In practice it'll probably be mp3, but this handles mp1 too for good measure. We don't advertise audio/mp1 as a supported media type since best I can tell that was never a MIME type that's been used. Fixes: #3531 --- internal/api/client/instance/instancepatch_test.go | 6 ++++++ internal/media/ffmpeg.go | 3 +++ internal/media/manager.go | 5 +++-- internal/typeutils/internaltofrontend_test.go | 2 ++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/internal/api/client/instance/instancepatch_test.go b/internal/api/client/instance/instancepatch_test.go index f126ee6ae..0ba0f9881 100644 --- a/internal/api/client/instance/instancepatch_test.go +++ b/internal/api/client/instance/instancepatch_test.go @@ -113,6 +113,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch1() { "image/webp", "audio/mp2", "audio/mp3", + "audio/mpeg", "video/x-msvideo", "audio/flac", "audio/x-flac", @@ -254,6 +255,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch2() { "image/webp", "audio/mp2", "audio/mp3", + "audio/mpeg", "video/x-msvideo", "audio/flac", "audio/x-flac", @@ -395,6 +397,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch3() { "image/webp", "audio/mp2", "audio/mp3", + "audio/mpeg", "video/x-msvideo", "audio/flac", "audio/x-flac", @@ -587,6 +590,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch6() { "image/webp", "audio/mp2", "audio/mp3", + "audio/mpeg", "video/x-msvideo", "audio/flac", "audio/x-flac", @@ -750,6 +754,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch8() { "image/webp", "audio/mp2", "audio/mp3", + "audio/mpeg", "video/x-msvideo", "audio/flac", "audio/x-flac", @@ -932,6 +937,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch9() { "image/webp", "audio/mp2", "audio/mp3", + "audio/mpeg", "video/x-msvideo", "audio/flac", "audio/x-flac", diff --git a/internal/media/ffmpeg.go b/internal/media/ffmpeg.go index c225d4378..342b7cbe1 100644 --- a/internal/media/ffmpeg.go +++ b/internal/media/ffmpeg.go @@ -377,6 +377,9 @@ func (res *result) GetFileType() (gtsmodel.FileType, string, string) { case "mp3": if len(res.audio) > 0 { switch res.audio[0].codec { + case "mp1": + return gtsmodel.FileTypeAudio, + "audio/mp1", "mp1" case "mp2": return gtsmodel.FileTypeAudio, "audio/mp2", "mp2" diff --git a/internal/media/manager.go b/internal/media/manager.go index 6aa13c17b..6d9c5629f 100644 --- a/internal/media/manager.go +++ b/internal/media/manager.go @@ -39,8 +39,9 @@ var SupportedMIMETypes = []string{ "image/gif", // .gif "image/webp", // .webp - "audio/mp2", // .mp2 - "audio/mp3", // .mp3 + "audio/mp2", // .mp2 + "audio/mp3", // .mp3 + "audio/mpeg", // .mp1, .mp2, .mp3 "video/x-msvideo", // .avi diff --git a/internal/typeutils/internaltofrontend_test.go b/internal/typeutils/internaltofrontend_test.go index 39a9bd9d4..005abf4eb 100644 --- a/internal/typeutils/internaltofrontend_test.go +++ b/internal/typeutils/internaltofrontend_test.go @@ -1960,6 +1960,7 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV1ToFrontend() { "image/webp", "audio/mp2", "audio/mp3", + "audio/mpeg", "video/x-msvideo", "audio/flac", "audio/x-flac", @@ -2105,6 +2106,7 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV2ToFrontend() { "image/webp", "audio/mp2", "audio/mp3", + "audio/mpeg", "video/x-msvideo", "audio/flac", "audio/x-flac",