From f832433fa5326fddd288d881a7cdca2b798369e3 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Tue, 6 Mar 2018 23:22:43 +0100 Subject: [PATCH] serve restic: Return empty list for non-existing dirs --- cmd/serve/restic/restic.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/serve/restic/restic.go b/cmd/serve/restic/restic.go index c00e2db03..8874c082f 100644 --- a/cmd/serve/restic/restic.go +++ b/cmd/serve/restic/restic.go @@ -16,6 +16,7 @@ import ( "github.com/ncw/rclone/cmd/serve/httplib" "github.com/ncw/rclone/cmd/serve/httplib/httpflags" "github.com/ncw/rclone/fs" + "github.com/ncw/rclone/fs/fserrors" "github.com/ncw/rclone/fs/object" "github.com/ncw/rclone/fs/operations" "github.com/ncw/rclone/fs/walk" @@ -343,10 +344,14 @@ func (s *server) listObjects(w http.ResponseWriter, r *http.Request, remote stri } return err }) + if err != nil { - fs.Errorf(remote, "list failed: %v", err) - http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) - return + _, err = fserrors.Cause(err) + if err != fs.ErrorDirNotFound { + fs.Errorf(remote, "list failed: %#v %T", err, err) + http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) + return + } } data, err := json.Marshal(ls)