[bugfix] determine mime-type to use during ffprobe evaluation stage, don't bother checking against file extension (#3506)

* determine mime-type to use during ffprobe evaluation stage, don't bother rechecking by file extension

* set mjpeg content-type

* fix up tests expecting differing default values
This commit is contained in:
kim 2024-11-04 13:58:15 +00:00 committed by GitHub
commit 8f288f1689
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 85 additions and 1378 deletions

View file

@ -18,7 +18,6 @@
package media
import (
"cmp"
"errors"
"fmt"
"io"
@ -28,7 +27,6 @@ import (
"codeberg.org/gruf/go-bytesize"
"codeberg.org/gruf/go-iotools"
"codeberg.org/gruf/go-mimetypes"
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
)
@ -87,12 +85,6 @@ func getExtension(path string) string {
return ""
}
// getMimeType returns a suitable mimetype for file extension.
func getMimeType(ext string) string {
const defaultType = "application/octet-stream"
return cmp.Or(mimetypes.MimeTypes[ext], defaultType)
}
// drainToTmp drains data from given reader into a new temp file
// and closes it, returning the path of the resulting temp file.
//