diff --git a/pkg/eosclient/eosbinary/eosbinary.go b/pkg/eosclient/eosbinary/eosbinary.go index 2217ce6d28..8c36061053 100644 --- a/pkg/eosclient/eosbinary/eosbinary.go +++ b/pkg/eosclient/eosbinary/eosbinary.go @@ -735,19 +735,8 @@ 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, stderr, err := c.executeEOS(ctx, args, auth) - if err != nil { - // Errcode 7: "TOOBIG" - if stdout != "" { - log.Debug().Msgf("eos find stdout= %s", stdout) - log.Debug().Msgf("=========== eos find stderr =========== %s", stderr) - return c.parseFind(ctx, auth, path, stdout) - } else { - log.Debug().Msgf("eosbinary - user had insufficient permissions to search part of the directory") - // There will be errors; we cannot ignore them: - return nil, errors.Wrapf(err, "eosclient: error listing fn=%s", path) - } - } + stdout, _, _ := c.executeEOS(ctx, args, auth) + // We can ignore errors and stderr, we're just interested on the EOS output log.Debug().Msgf("eos find stdout= %s", stdout) return c.parseFind(ctx, auth, path, stdout) } diff --git a/pkg/storage/utils/eosfs/eosfs.go b/pkg/storage/utils/eosfs/eosfs.go index 511626f1c0..bcb80a57e3 100644 --- a/pkg/storage/utils/eosfs/eosfs.go +++ b/pkg/storage/utils/eosfs/eosfs.go @@ -1336,25 +1336,29 @@ func (fs *eosfs) ListFolder(ctx context.Context, ref *provider.Reference, mdKeys // - also check that searchString not empty: searchString = mdKeys[i+1] + if searchString == "" { + return nil, errtypes.NotSupported("Search requires a search string") + } + log.Debug().Msgf("eosfs: running search: path=%s searchString=%s", p, searchString) eosFileInfos, err := fs.c.SearchDir(ctx, auth, searchString, p) + if err != nil { return nil, errors.Wrap(err, "eosfs: error searching") } for _, eosFileInfo := range eosFileInfos { - // filter out sys files - if !fs.conf.ShowHiddenSysFiles { - base := path.Base(eosFileInfo.File) - if hiddenReg.MatchString(base) { - continue - } - } - if finfo, err := fs.convertToFileReference(ctx, eosFileInfo); err == nil { + log.Debug().Msgf("seach: eosFileInfo %s", eosFileInfo.File) + + // Search all files, hidden and not, for the time being + + if finfo, err := fs.convertToResourceInfo(ctx, eosFileInfo); err == nil { log.Debug().Msgf("eosfs: file name from search %s", finfo.Name) finfos = append(finfos, finfo) + } else { + log.Error().Err(err).Msg(" wtf 🥘") } } @@ -2120,6 +2124,8 @@ func (fs *eosfs) convertToResourceInfo(ctx context.Context, eosFileInfo *eosclie } func (fs *eosfs) convertToFileReference(ctx context.Context, eosFileInfo *eosclient.FileInfo) (*provider.ResourceInfo, error) { + log := appctx.GetLogger(ctx) + log.Debug().Msg("convertToFileReference") info, err := fs.convert(ctx, eosFileInfo) if err != nil { return nil, err @@ -2258,6 +2264,8 @@ func mergePermissions(l *provider.ResourcePermissions, r *provider.ResourcePermi } func (fs *eosfs) convert(ctx context.Context, eosFileInfo *eosclient.FileInfo) (*provider.ResourceInfo, error) { + log := appctx.GetLogger(ctx) + log.Debug().Msg("convert") path, err := fs.unwrap(ctx, eosFileInfo.File) if err != nil { return nil, err @@ -2293,6 +2301,8 @@ func (fs *eosfs) convert(ctx context.Context, eosFileInfo *eosclient.FileInfo) ( } } + log.Debug().Msgf("convert: marshalling the eosFileInfo %s", eosFileInfo) + info := &provider.ResourceInfo{ Id: &provider.ResourceId{OpaqueId: fmt.Sprintf("%d", eosFileInfo.Inode)}, Path: path,