From b13a6437ff2da5c802a218e8938ab2eb805f52ef Mon Sep 17 00:00:00 2001 From: kim Date: Fri, 6 Jun 2025 16:35:39 +0200 Subject: [chore] move s3 storage key prefixing into the storage library itself (#4246) This is just a useful feature that it seemed more semantically correct to have in the storage library itself! Still, thank you to @vdyotte for the original change :) Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4246 Co-authored-by: kim Co-committed-by: kim --- internal/cleaner/media.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'internal/cleaner') diff --git a/internal/cleaner/media.go b/internal/cleaner/media.go index 043d7cf5f..84473bc22 100644 --- a/internal/cleaner/media.go +++ b/internal/cleaner/media.go @@ -20,7 +20,6 @@ package cleaner import ( "context" "errors" - "strings" "time" "code.superseriousbusiness.org/gotosocial/internal/db" @@ -94,10 +93,10 @@ func (m *Media) LogFixCacheStates(ctx context.Context) { func (m *Media) PruneOrphaned(ctx context.Context) (int, error) { var files []string - // All media files in storage will have path fitting: {$account}/{$type}/{$size}/{$id}.{$ext} + // All media in storage will have path: {$account}/{$type}/{$size}/{$id}.{$ext} if err := m.state.Storage.WalkKeys(ctx, func(path string) error { - // Check for our expected fileserver path format. - path = strings.TrimPrefix(path, m.state.Storage.KeyPrefix) + + // Check for expected fileserver path format. if !regexes.FilePath.MatchString(path) { log.Warnf(ctx, "unexpected storage item: %s", path) return nil -- cgit v1.2.3