diff --git a/cmd/serve/restic/restic.go b/cmd/serve/restic/restic.go index 113036f48..00799dd54 100644 --- a/cmd/serve/restic/restic.go +++ b/cmd/serve/restic/restic.go @@ -330,25 +330,12 @@ func (s *server) listObjects(w http.ResponseWriter, r *http.Request, remote stri ls := listItems{} // if remote supports ListR use that directly, otherwise use recursive Walk - var err error - if ListR := s.f.Features().ListR; ListR != nil { - err = ListR(remote, func(entries fs.DirEntries) error { - for _, entry := range entries { - ls.add(entry) - } - return nil - }) - } else { - err = walk.Walk(s.f, remote, true, -1, func(path string, entries fs.DirEntries, err error) error { - if err == nil { - for _, entry := range entries { - ls.add(entry) - } - } - return err - }) - } - + err := walk.ListR(s.f, remote, true, -1, walk.ListObjects, func(entries fs.DirEntries) error { + for _, entry := range entries { + ls.add(entry) + } + return nil + }) if err != nil { _, err = fserrors.Cause(err) if err != fs.ErrorDirNotFound {