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

This commit is contained in:
kim 2024-11-01 21:35:11 +00:00
commit 36409a4ac0
13 changed files with 76 additions and 1369 deletions

View file

@ -163,9 +163,10 @@ func (p *ProcessingEmoji) store(ctx context.Context) error {
}
var ext string
var fileType gtsmodel.FileType
// Get type from ffprobe format data.
fileType, ext := result.GetFileType()
// Get abstract file type, mimetype and ext from ffprobe data.
fileType, p.emoji.ImageContentType, ext = result.GetFileType()
if fileType != gtsmodel.FileTypeImage {
return gtserror.Newf("unsupported emoji filetype: %s (%s)", fileType, ext)
}
@ -216,10 +217,6 @@ func (p *ProcessingEmoji) store(ctx context.Context) error {
"png",
)
// Get mimetype for the file container
// type, falling back to generic data.
p.emoji.ImageContentType = getMimeType(ext)
// Set the known emoji static content type.
p.emoji.ImageStaticContentType = "image/png"