gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 6a6647d68baaefbd19ef6010c889ebd7980667b1
parent 02767bfc7d40d22848cf74106373a9c36334bf03
Author: Sam Lade <sam@sentynel.com>
Date:   Mon,  6 Feb 2023 14:58:54 +0000

Ignore missing files when cleaning up media (#1435)


Diffstat:
Minternal/processing/media/delete.go | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/internal/processing/media/delete.go b/internal/processing/media/delete.go @@ -2,9 +2,11 @@ package media import ( "context" + "errors" "fmt" "strings" + "codeberg.org/gruf/go-store/v2/storage" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtserror" ) @@ -24,14 +26,14 @@ func (p *processor) Delete(ctx context.Context, mediaAttachmentID string) gtserr // delete the thumbnail from storage if attachment.Thumbnail.Path != "" { - if err := p.storage.Delete(ctx, attachment.Thumbnail.Path); err != nil { + if err := p.storage.Delete(ctx, attachment.Thumbnail.Path); err != nil && !errors.Is(err, storage.ErrNotFound) { errs = append(errs, fmt.Sprintf("remove thumbnail at path %s: %s", attachment.Thumbnail.Path, err)) } } // delete the file from storage if attachment.File.Path != "" { - if err := p.storage.Delete(ctx, attachment.File.Path); err != nil { + if err := p.storage.Delete(ctx, attachment.File.Path); err != nil && !errors.Is(err, storage.ErrNotFound) { errs = append(errs, fmt.Sprintf("remove file at path %s: %s", attachment.File.Path, err)) } }