summaryrefslogtreecommitdiff
path: root/internal/cleaner/media.go
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-06-06 16:35:39 +0200
committerLibravatar kim <gruf@noreply.codeberg.org>2025-06-06 16:35:39 +0200
commitb13a6437ff2da5c802a218e8938ab2eb805f52ef (patch)
tree295cc5e25dcc27ad9ffe0c16f5f32d0f56eae060 /internal/cleaner/media.go
parent[chore] updates code.superseriousbusiness.org/oauth2/v4 to ssb-v4.5.3-1 (#4245) (diff)
downloadgotosocial-b13a6437ff2da5c802a218e8938ab2eb805f52ef.tar.xz
[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 <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'internal/cleaner/media.go')
-rw-r--r--internal/cleaner/media.go7
1 files changed, 3 insertions, 4 deletions
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