serve restic: use walk.ListR for listing
This is effectively what the old code did anyway so this should not make any functional changes.
This commit is contained in:
parent
d5f2df2f3d
commit
e5f4210b09
1 changed files with 6 additions and 19 deletions
|
@ -330,25 +330,12 @@ func (s *server) listObjects(w http.ResponseWriter, r *http.Request, remote stri
|
||||||
ls := listItems{}
|
ls := listItems{}
|
||||||
|
|
||||||
// if remote supports ListR use that directly, otherwise use recursive Walk
|
// if remote supports ListR use that directly, otherwise use recursive Walk
|
||||||
var err error
|
err := walk.ListR(s.f, remote, true, -1, walk.ListObjects, func(entries fs.DirEntries) error {
|
||||||
if ListR := s.f.Features().ListR; ListR != nil {
|
for _, entry := range entries {
|
||||||
err = ListR(remote, func(entries fs.DirEntries) error {
|
ls.add(entry)
|
||||||
for _, entry := range entries {
|
}
|
||||||
ls.add(entry)
|
return nil
|
||||||
}
|
})
|
||||||
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
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_, err = fserrors.Cause(err)
|
_, err = fserrors.Cause(err)
|
||||||
if err != fs.ErrorDirNotFound {
|
if err != fs.ErrorDirNotFound {
|
||||||
|
|
Loading…
Reference in a new issue