[feature] Media attachment placeholders (#2331)

* [feature] Use placeholders for unknown media types

* fix read of underreported small files

* switch to reduce nesting

* simplify cleanup
This commit is contained in:
tobi
2023-11-10 19:29:26 +01:00
committed by GitHub
parent c7ecab9e6f
commit ba9d6b467a
41 changed files with 1472 additions and 841 deletions

View File

@@ -55,7 +55,7 @@ func (p *Processor) EmojiCreate(ctx context.Context, account *gtsmodel.Account,
return nil, gtserror.NewErrorInternalError(fmt.Errorf("error creating id for new emoji: %s", err), "error creating emoji ID")
}
emojiURI := uris.GenerateURIForEmoji(emojiID)
emojiURI := uris.URIForEmoji(emojiID)
data := func(innerCtx context.Context) (io.ReadCloser, int64, error) {
f, err := form.Image.Open()
@@ -335,7 +335,7 @@ func (p *Processor) emojiUpdateCopy(ctx context.Context, emoji *gtsmodel.Emoji,
return nil, gtserror.NewErrorInternalError(err)
}
newEmojiURI := uris.GenerateURIForEmoji(newEmojiID)
newEmojiURI := uris.URIForEmoji(newEmojiID)
data := func(ctx context.Context) (reader io.ReadCloser, fileSize int64, err error) {
rc, err := p.state.Storage.GetStream(ctx, emoji.ImagePath)