Skip to content

Commit

Permalink
[bugfix] Advertise audio/mpeg as supported
Browse files Browse the repository at this point in the history
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
  • Loading branch information
daenney committed Dec 27, 2024
1 parent 0784aa3 commit 18393c0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions internal/api/client/instance/instancepatch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch1() {
"image/webp",
"audio/mp2",
"audio/mp3",
"audio/mpeg",
"video/x-msvideo",
"audio/flac",
"audio/x-flac",
Expand Down Expand Up @@ -254,6 +255,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch2() {
"image/webp",
"audio/mp2",
"audio/mp3",
"audio/mpeg",
"video/x-msvideo",
"audio/flac",
"audio/x-flac",
Expand Down Expand Up @@ -395,6 +397,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch3() {
"image/webp",
"audio/mp2",
"audio/mp3",
"audio/mpeg",
"video/x-msvideo",
"audio/flac",
"audio/x-flac",
Expand Down Expand Up @@ -587,6 +590,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch6() {
"image/webp",
"audio/mp2",
"audio/mp3",
"audio/mpeg",
"video/x-msvideo",
"audio/flac",
"audio/x-flac",
Expand Down Expand Up @@ -750,6 +754,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch8() {
"image/webp",
"audio/mp2",
"audio/mp3",
"audio/mpeg",
"video/x-msvideo",
"audio/flac",
"audio/x-flac",
Expand Down Expand Up @@ -932,6 +937,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch9() {
"image/webp",
"audio/mp2",
"audio/mp3",
"audio/mpeg",
"video/x-msvideo",
"audio/flac",
"audio/x-flac",
Expand Down
3 changes: 3 additions & 0 deletions internal/media/ffmpeg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 3 additions & 2 deletions internal/media/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions internal/typeutils/internaltofrontend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1960,6 +1960,7 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV1ToFrontend() {
"image/webp",
"audio/mp2",
"audio/mp3",
"audio/mpeg",
"video/x-msvideo",
"audio/flac",
"audio/x-flac",
Expand Down Expand Up @@ -2105,6 +2106,7 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV2ToFrontend() {
"image/webp",
"audio/mp2",
"audio/mp3",
"audio/mpeg",
"video/x-msvideo",
"audio/flac",
"audio/x-flac",
Expand Down

0 comments on commit 18393c0

Please sign in to comment.