mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 19:32:26 -05:00
[chore] Fixes + updates in emoji dereferencing logic (#1022)
* fix incorrect static remote url use for emojis * warn when emoji/attachment already exists * defer emoji postdata execution * rename ctx to innerCtx for clarity * warn on emoji too large * small efficiency fix in fetchRemoteAccountEmojis * tidy up lock+load * lock processing emojis * fix little fucky wucky * this wasn't go fmted for some reason
This commit is contained in:
parent
edcee14d07
commit
6fb47651c8
8 changed files with 191 additions and 75 deletions
|
|
@ -21,6 +21,7 @@ package media
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
|
|
@ -349,8 +350,11 @@ func (p *ProcessingMedia) store(ctx context.Context) error {
|
|||
p.attachment.File.Path = fmt.Sprintf("%s/%s/%s/%s.%s", p.attachment.AccountID, TypeAttachment, SizeOriginal, p.attachment.ID, extension)
|
||||
|
||||
// store this for now -- other processes can pull it out of storage as they please
|
||||
if fileSize, err = putStream(ctx, p.storage, p.attachment.File.Path, readerToStore, fileSize); err != nil && err != storage.ErrAlreadyExists {
|
||||
return fmt.Errorf("store: error storing stream: %s", err)
|
||||
if fileSize, err = putStream(ctx, p.storage, p.attachment.File.Path, readerToStore, fileSize); err != nil {
|
||||
if !errors.Is(err, storage.ErrAlreadyExists) {
|
||||
return fmt.Errorf("store: error storing stream: %s", err)
|
||||
}
|
||||
log.Warnf("attachment %s already exists at storage path: %s", p.attachment.ID, p.attachment.File.Path)
|
||||
}
|
||||
|
||||
cached := true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue