mirror of
https://github.com/rclone/rclone.git
synced 2024-11-26 10:13:52 +08:00
serve restic: Return empty list for non-existing dirs
This commit is contained in:
parent
d073efdc6c
commit
f832433fa5
|
@ -16,6 +16,7 @@ import (
|
||||||
"github.com/ncw/rclone/cmd/serve/httplib"
|
"github.com/ncw/rclone/cmd/serve/httplib"
|
||||||
"github.com/ncw/rclone/cmd/serve/httplib/httpflags"
|
"github.com/ncw/rclone/cmd/serve/httplib/httpflags"
|
||||||
"github.com/ncw/rclone/fs"
|
"github.com/ncw/rclone/fs"
|
||||||
|
"github.com/ncw/rclone/fs/fserrors"
|
||||||
"github.com/ncw/rclone/fs/object"
|
"github.com/ncw/rclone/fs/object"
|
||||||
"github.com/ncw/rclone/fs/operations"
|
"github.com/ncw/rclone/fs/operations"
|
||||||
"github.com/ncw/rclone/fs/walk"
|
"github.com/ncw/rclone/fs/walk"
|
||||||
|
@ -343,10 +344,14 @@ func (s *server) listObjects(w http.ResponseWriter, r *http.Request, remote stri
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fs.Errorf(remote, "list failed: %v", err)
|
_, err = fserrors.Cause(err)
|
||||||
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
|
if err != fs.ErrorDirNotFound {
|
||||||
return
|
fs.Errorf(remote, "list failed: %#v %T", err, err)
|
||||||
|
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := json.Marshal(ls)
|
data, err := json.Marshal(ls)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user