diff --git a/internal/http/services/owncloud/ocdav/report.go b/internal/http/services/owncloud/ocdav/report.go index ef82b63e0f..edef86dde1 100644 --- a/internal/http/services/owncloud/ocdav/report.go +++ b/internal/http/services/owncloud/ocdav/report.go @@ -27,7 +27,7 @@ import ( rpcv1beta1 "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" - typespb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" + types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" "github.com/cs3org/reva/pkg/appctx" ctxpkg "github.com/cs3org/reva/pkg/ctx" ) @@ -49,7 +49,7 @@ func (s *svc) handleReport(w http.ResponseWriter, r *http.Request, ns string) { return } - log.Info().Msgf("hugo: searching in path: %s with pattern: %s", r.URL.Path, rep.SearchFiles.Search.Pattern) + log.Info().Msgf("searching in path: %s with pattern: %s", r.URL.Path, rep.SearchFiles.Search.Pattern) if rep.SearchFiles != nil { s.doSearchFiles(w, r, rep.SearchFiles) @@ -68,7 +68,7 @@ func (s *svc) doSearchFiles(w http.ResponseWriter, r *http.Request, sf *reportSe ctx := r.Context() log := appctx.GetLogger(ctx) - log.Info().Msgf("hugo: search is: %+v", sf) + log.Info().Msgf("search is: %+v", sf) client, err := s.getClient() if err != nil { @@ -77,7 +77,7 @@ func (s *svc) doSearchFiles(w http.ResponseWriter, r *http.Request, sf *reportSe return } - opaqueMap := map[string]*typespb.OpaqueEntry{ + opaqueMap := map[string]*types.OpaqueEntry{ "search": { Decoder: "plain", Value: []byte("search"), @@ -88,10 +88,10 @@ func (s *svc) doSearchFiles(w http.ResponseWriter, r *http.Request, sf *reportSe }, } - // TODO(salfagem): hardcoded path for the time being: - ref := &provider.Reference{Path: "/eos/project/t/test"} + // TODO(salfagem): hardcoded path for the time being, enable a list: + ref := &provider.Reference{Path: "/eos/project/a/awesomeproject"} - req := &provider.ListContainerRequest{Opaque: &typespb.Opaque{ + req := &provider.ListContainerRequest{Opaque: &types.Opaque{ Map: opaqueMap, }, Ref: ref} diff --git a/pkg/eosclient/eosbinary/eosbinary.go b/pkg/eosclient/eosbinary/eosbinary.go index 74ba672b5d..3a8eb379ae 100644 --- a/pkg/eosclient/eosbinary/eosbinary.go +++ b/pkg/eosclient/eosbinary/eosbinary.go @@ -720,11 +720,11 @@ func (c *Client) List(ctx context.Context, auth eosclient.Authorization, path st // List the contents of the directory given by path with depth infinity func (c *Client) SearchDir(ctx context.Context, auth eosclient.Authorization, searchString string, path string) ([]*eosclient.FileInfo, error) { // TODO(salfagem): path is truncated - i.e. /c/cernbox (not absolute) - args := []string{"newfind", "--fileinfo", "--name", searchString, path} + args := []string{"find", "--fileinfo", "-name", searchString, path} log := appctx.GetLogger(ctx) log.Debug().Msgf("eosbinary search with args: %s", args) // Safeguard #2 to prevent the search to go to undesired places: - if !strings.HasPrefix(path, "/eos/project/t/test") { + if !strings.HasPrefix(path, "/eos/project/a/awesomeproject") { log.Debug().Msgf("eosbinary - prefix doesn't match") return nil, errors.Errorf("eosclient: search path out of bounds fn=%s", path) } @@ -735,18 +735,19 @@ func (c *Client) SearchDir(ctx context.Context, auth eosclient.Authorization, se return nil, errors.Errorf("eosclient: ilegal search string: %s", searchString) } // TODO: set a timeout for the find in case it goes out of hand - stdout, _, err := c.executeEOS(ctx, args, auth) + stdout, stderr, err := c.executeEOS(ctx, args, auth) if err != nil { switch err.(type) { - case errtypes.NotFound, errtypes.PermissionDenied: + // Errcode 7: "TOOBIG" + case errtypes.IsNotFound, errtypes.IsPermissionDenied: log.Debug().Msgf("eosbinary - user had insufficient permissions to search part of the directory") default: - log.Error().Msgf("ERRROR LISTING= %s", stdout) - // There will be errors: - //return nil, errors.Wrapf(err, "eosclient: error listing fn=%s", path) + // There will be errors; we cannot ignore them: + return nil, errors.Wrapf(err, "eosclient: error listing fn=%s", path) } } log.Debug().Msgf("eos find stdout= %s", stdout) + log.Debug().Msgf("=========== eos find stderr =========== %s", stderr) return c.parseFind(ctx, auth, path, stdout) }