diff --git a/changelog/unreleased/appprovider-stat.md b/changelog/unreleased/appprovider-stat.md new file mode 100644 index 0000000000..d71b1eb7dd --- /dev/null +++ b/changelog/unreleased/appprovider-stat.md @@ -0,0 +1,7 @@ +Bugfix: Call the gateway stat method from appprovider + +The appprovider service used to directly pass the stat request to the storage +provider bypassing the gateway, which resulted in errors while handling share +children as they are resolved in the gateway path. + +https://github.com/cs3org/reva/pull/1140 diff --git a/internal/grpc/services/gateway/appprovider.go b/internal/grpc/services/gateway/appprovider.go index aa4c0933a1..22d1706d5a 100644 --- a/internal/grpc/services/gateway/appprovider.go +++ b/internal/grpc/services/gateway/appprovider.go @@ -37,22 +37,11 @@ import ( ) func (s *svc) OpenFileInAppProvider(ctx context.Context, req *gateway.OpenFileInAppProviderRequest) (*providerpb.OpenFileInAppProviderResponse, error) { - c, err := s.find(ctx, req.Ref) - if err != nil { - if _, ok := err.(errtypes.IsNotFound); ok { - return &providerpb.OpenFileInAppProviderResponse{ - Status: status.NewInternal(ctx, err, "storage provider not found"), - }, nil - } - return &providerpb.OpenFileInAppProviderResponse{ - Status: status.NewInternal(ctx, err, "error finding storage provider"), - }, nil - } accessToken, ok := tokenpkg.ContextGetToken(ctx) if !ok || accessToken == "" { return &providerpb.OpenFileInAppProviderResponse{ - Status: status.NewUnauthenticated(ctx, err, "Access token is invalid or empty"), + Status: status.NewUnauthenticated(ctx, errors.New("Access token is invalid or empty"), ""), }, nil } @@ -60,7 +49,7 @@ func (s *svc) OpenFileInAppProvider(ctx context.Context, req *gateway.OpenFileIn Ref: req.Ref, } - statRes, err := c.Stat(ctx, statReq) + statRes, err := s.Stat(ctx, statReq) if err != nil { return &providerpb.OpenFileInAppProviderResponse{ Status: status.NewInternal(ctx, err, "gateway: error calling Stat on the resource path for the app provider: "+req.Ref.GetPath()),