[feature] Allow webp emoji uploads / derefs (#2484)

This commit is contained in:
tobi 2024-01-05 13:39:53 +01:00 committed by GitHub
commit 72d0f46b0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 66 additions and 8 deletions

View file

@ -21,6 +21,7 @@ import (
"bytes"
"context"
"io"
"slices"
"codeberg.org/gruf/go-bytesize"
"codeberg.org/gruf/go-errors/v2"
@ -57,7 +58,6 @@ func (p *ProcessingEmoji) EmojiID() string {
func (p *ProcessingEmoji) LoadEmoji(ctx context.Context) (*gtsmodel.Emoji, error) {
// Attempt to load synchronously.
emoji, done, err := p.load(ctx)
if err == nil {
// No issue, return media.
return emoji, nil
@ -209,12 +209,8 @@ func (p *ProcessingEmoji) store(ctx context.Context) error {
return gtserror.Newf("error parsing file type: %w", err)
}
switch info.Extension {
// only supported emoji types
case "gif", "png":
// unhandled
default:
// Ensure supported emoji img type.
if !slices.Contains(SupportedEmojiMIMETypes, info.MIME.Value) {
return gtserror.Newf("unsupported emoji filetype: %s", info.Extension)
}