diff --git a/pkg/proc/delete_handler.go b/pkg/proc/delete_handler.go index 93ace46..42211ea 100644 --- a/pkg/proc/delete_handler.go +++ b/pkg/proc/delete_handler.go @@ -116,7 +116,7 @@ func (dh *BasicDeleteHandler) ListGarbageFiles(msg message.DeleteMessage) ([]str } //list files in storage - ylogger.Zero.Info().Str("path", msg.Name).Msg("going to list path") + ylogger.Zero.Info().Str("path", msg.Name).Msg("listing prefix") objectMetas, err := dh.StorageInterractor.ListPath(msg.Name) if err != nil { return nil, errors.Wrap(err, "could not list objects") diff --git a/pkg/storage/s3storage.go b/pkg/storage/s3storage.go index fe1ccba..e366c3a 100644 --- a/pkg/storage/s3storage.go +++ b/pkg/storage/s3storage.go @@ -174,8 +174,16 @@ func (s *S3StorageInteractor) ListPath(prefix string) ([]*object.ObjectInfo, err } for _, obj := range out.Contents { + path := *obj.Key + + ylogger.Zero.Debug().Str("path", path).Msg("listing file") + + cPath, ok := strings.CutPrefix(path, s.cnf.StoragePrefix) + if !ok { + continue + } metas = append(metas, &object.ObjectInfo{ - Path: *obj.Key, + Path: "/" + cPath, Size: *obj.Size, }) }