@@ -720,11 +720,11 @@ func (c *Client) List(ctx context.Context, auth eosclient.Authorization, path st
720
720
// List the contents of the directory given by path with depth infinity
721
721
func (c * Client ) SearchDir (ctx context.Context , auth eosclient.Authorization , searchString string , path string ) ([]* eosclient.FileInfo , error ) {
722
722
// TODO(salfagem): path is truncated - i.e. /c/cernbox (not absolute)
723
- args := []string {"newfind " , "--fileinfo" , "- -name" , searchString , path }
723
+ args := []string {"find " , "--fileinfo" , "-name" , searchString , path }
724
724
log := appctx .GetLogger (ctx )
725
725
log .Debug ().Msgf ("eosbinary search with args: %s" , args )
726
726
// Safeguard #2 to prevent the search to go to undesired places:
727
- if ! strings .HasPrefix (path , "/eos/project/t/test " ) {
727
+ if ! strings .HasPrefix (path , "/eos/project/a/awesomeproject " ) {
728
728
log .Debug ().Msgf ("eosbinary - prefix doesn't match" )
729
729
return nil , errors .Errorf ("eosclient: search path out of bounds fn=%s" , path )
730
730
}
@@ -735,15 +735,17 @@ func (c *Client) SearchDir(ctx context.Context, auth eosclient.Authorization, se
735
735
return nil , errors .Errorf ("eosclient: ilegal search string: %s" , searchString )
736
736
}
737
737
// TODO: set a timeout for the find in case it goes out of hand
738
- stdout , _ , err := c .executeEOS (ctx , args , auth )
738
+ stdout , stderr , err := c .executeEOS (ctx , args , auth )
739
739
if err != nil {
740
- switch err .(type ) {
741
- case errtypes.NotFound , errtypes.PermissionDenied :
740
+ // Errcode 7: "TOOBIG"
741
+ if stdout != "" {
742
+ log .Debug ().Msgf ("eos find stdout= %s" , stdout )
743
+ log .Debug ().Msgf ("=========== eos find stderr =========== %s" , stderr )
744
+ return c .parseFind (ctx , auth , path , stdout )
745
+ } else {
742
746
log .Debug ().Msgf ("eosbinary - user had insufficient permissions to search part of the directory" )
743
- default :
744
- log .Error ().Msgf ("ERRROR LISTING= %s" , stdout )
745
- // There will be errors:
746
- //return nil, errors.Wrapf(err, "eosclient: error listing fn=%s", path)
747
+ // There will be errors; we cannot ignore them:
748
+ return nil , errors .Wrapf (err , "eosclient: error listing fn=%s" , path )
747
749
}
748
750
}
749
751
log .Debug ().Msgf ("eos find stdout= %s" , stdout )
0 commit comments