diff options
author | 2022-11-11 20:27:37 +0100 | |
---|---|---|
committer | 2022-11-11 19:27:37 +0000 | |
commit | 6fb47651c8dd7b1c73963f6a3a6c7d95f43dc239 (patch) | |
tree | f5a7dc848a78b6269622cb0cab2317cece2f5829 /internal/media/processingmedia.go | |
parent | [feature] Read + Write tombstones for deleted Actors (#1005) (diff) | |
download | gotosocial-6fb47651c8dd7b1c73963f6a3a6c7d95f43dc239.tar.xz |
[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
Diffstat (limited to 'internal/media/processingmedia.go')
-rw-r--r-- | internal/media/processingmedia.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/media/processingmedia.go b/internal/media/processingmedia.go index 1247586cb..c724de849 100644 --- a/internal/media/processingmedia.go +++ b/internal/media/processingmedia.go @@ -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 |