Skip to content
This repository was archived by the owner on Jan 31, 2024. It is now read-only.

Commit 8736519

Browse files
committed
search: log stderr from 'eos find' and replace mock response
1 parent d8a4e55 commit 8736519

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

internal/http/services/owncloud/ocdav/report.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727

2828
rpcv1beta1 "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
2929
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
30-
typespb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
30+
types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
3131
"github.com/cs3org/reva/pkg/appctx"
3232
ctxpkg "github.com/cs3org/reva/pkg/ctx"
3333
)
@@ -68,7 +68,7 @@ func (s *svc) doSearchFiles(w http.ResponseWriter, r *http.Request, sf *reportSe
6868
ctx := r.Context()
6969
log := appctx.GetLogger(ctx)
7070

71-
log.Info().Msgf("hugo: search is: %+v", sf)
71+
log.Info().Msgf("search is: %+v", sf)
7272

7373
client, err := s.getClient()
7474
if err != nil {
@@ -77,7 +77,7 @@ func (s *svc) doSearchFiles(w http.ResponseWriter, r *http.Request, sf *reportSe
7777
return
7878
}
7979

80-
opaqueMap := map[string]*typespb.OpaqueEntry{
80+
opaqueMap := map[string]*types.OpaqueEntry{
8181
"search": {
8282
Decoder: "plain",
8383
Value: []byte("search"),
@@ -88,10 +88,10 @@ func (s *svc) doSearchFiles(w http.ResponseWriter, r *http.Request, sf *reportSe
8888
},
8989
}
9090

91-
// TODO(salfagem): hardcoded path for the time being:
92-
ref := &provider.Reference{Path: "/eos/project/t/test"}
91+
// TODO(salfagem): hardcoded path for the time being, enable a list:
92+
ref := &provider.Reference{Path: "/eos/project/a/awesomeproject"}
9393

94-
req := &provider.ListContainerRequest{Opaque: &typespb.Opaque{
94+
req := &provider.ListContainerRequest{Opaque: &types.Opaque{
9595
Map: opaqueMap,
9696
}, Ref: ref}
9797

pkg/eosclient/eosbinary/eosbinary.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ func (c *Client) SearchDir(ctx context.Context, auth eosclient.Authorization, se
724724
log := appctx.GetLogger(ctx)
725725
log.Debug().Msgf("eosbinary search with args: %s", args)
726726
// 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") {
728728
log.Debug().Msgf("eosbinary - prefix doesn't match")
729729
return nil, errors.Errorf("eosclient: search path out of bounds fn=%s", path)
730730
}
@@ -735,18 +735,18 @@ func (c *Client) SearchDir(ctx context.Context, auth eosclient.Authorization, se
735735
return nil, errors.Errorf("eosclient: ilegal search string: %s", searchString)
736736
}
737737
// 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)
739739
if err != nil {
740740
switch err.(type) {
741-
case errtypes.NotFound, errtypes.PermissionDenied:
741+
case errtypes.IsNotFound, errtypes.IsPermissionDenied:
742742
log.Debug().Msgf("eosbinary - user had insufficient permissions to search part of the directory")
743743
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)
744+
// There will be errors; we cannot ignore them:
745+
return nil, errors.Wrapf(err, "eosclient: error listing fn=%s", path)
747746
}
748747
}
749748
log.Debug().Msgf("eos find stdout= %s", stdout)
749+
log.Debug().Msgf("=========== eos find stderr =========== %s", stderr)
750750
return c.parseFind(ctx, auth, path, stdout)
751751
}
752752

0 commit comments

Comments
 (0)