diff --git a/changelog/unreleased/return-err-list.md b/changelog/unreleased/return-err-list.md new file mode 100644 index 0000000000..674b62433c --- /dev/null +++ b/changelog/unreleased/return-err-list.md @@ -0,0 +1,6 @@ +Bugfix: Return an error when EOS List errors + +If we get an error while reading items, we now return the error to the user and break off the List operation +We do not want to return a partial list, because then a sync client may delete local files that are missing on the server + +https://github.com/cs3org/reva/pull/5044 \ No newline at end of file diff --git a/pkg/eosclient/eosgrpc/eosgrpc.go b/pkg/eosclient/eosgrpc/eosgrpc.go index 49f82dd718..c9e18c737c 100644 --- a/pkg/eosclient/eosgrpc/eosgrpc.go +++ b/pkg/eosclient/eosgrpc/eosgrpc.go @@ -1259,12 +1259,12 @@ func (c *Client) List(ctx context.Context, auth eosclient.Authorization, dpath s break } - // We got an error while reading items. We log this as an error and we return - // the items we have + // We got an error while reading items. We return the error to the user and break off the List operation + // We do not want to return a partial list, because then a sync client may delete local files that are missing on the server log.Error().Err(err).Str("func", "List").Int("nitems", i).Str("path", dpath).Str("got err from EOS", err.Error()).Msg("") if i > 0 { log.Error().Str("path", dpath).Int("nitems", i).Msg("No more items, dirty exit") - return mylst, nil + return nil, errors.Wrap(err, "Error listing files") } }