diff --git a/go.mod b/go.mod index 7ade84ee2d0..65d8a9b0faf 100644 --- a/go.mod +++ b/go.mod @@ -360,3 +360,5 @@ replace github.com/egirna/icap-client => github.com/fschade/icap-client v0.0.0-2 // exclude the v2 line of go-sqlite3 which was released accidentally and prevents pulling in newer versions of go-sqlite3 // see https://github.com/mattn/go-sqlite3/issues/965 for more details exclude github.com/mattn/go-sqlite3 v2.0.3+incompatible + +replace github.com/cs3org/reva/v2 => github.com/rhafer/reva/v2 v2.0.0-20240221095205-62cb6cd94e83 diff --git a/go.sum b/go.sum index 4b9ea7da0e3..378b5da4709 100644 --- a/go.sum +++ b/go.sum @@ -1019,8 +1019,6 @@ github.com/crewjam/saml v0.4.14 h1:g9FBNx62osKusnFzs3QTN5L9CVA/Egfgm+stJShzw/c= github.com/crewjam/saml v0.4.14/go.mod h1:UVSZCf18jJkk6GpWNVqcyQJMD5HsRugBPf4I1nl2mME= github.com/cs3org/go-cs3apis v0.0.0-20231023073225-7748710e0781 h1:BUdwkIlf8IS2FasrrPg8gGPHQPOrQ18MS1Oew2tmGtY= github.com/cs3org/go-cs3apis v0.0.0-20231023073225-7748710e0781/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= -github.com/cs3org/reva/v2 v2.18.1-0.20240221074425-cac6c6935c60 h1:cx4hWeWKYnIa8m5z9JncRc+lt/+RB3mwg/kZWBbDPAc= -github.com/cs3org/reva/v2 v2.18.1-0.20240221074425-cac6c6935c60/go.mod h1:GRUrOp5HbFVwZTgR9bVrMZ/MvVy+Jhxw1PdMmhhKP9E= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= @@ -1898,6 +1896,8 @@ github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/rhafer/reva/v2 v2.0.0-20240221095205-62cb6cd94e83 h1:KJhrSlxh0INJqGXlpEbMBXGuplq3GfoZNR/08n8W8qs= +github.com/rhafer/reva/v2 v2.0.0-20240221095205-62cb6cd94e83/go.mod h1:GRUrOp5HbFVwZTgR9bVrMZ/MvVy+Jhxw1PdMmhhKP9E= github.com/riandyrn/otelchi v0.5.1 h1:0/45omeqpP7f/cvdL16GddQBfAEmZvUyl2QzLSE6uYo= github.com/riandyrn/otelchi v0.5.1/go.mod h1:ZxVxNEl+jQ9uHseRYIxKWRb3OY8YXFEu+EkNiiSNUEA= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= diff --git a/vendor/github.com/cs3org/reva/v2/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go b/vendor/github.com/cs3org/reva/v2/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go index da3624fd7ad..8d5316c6d93 100644 --- a/vendor/github.com/cs3org/reva/v2/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go +++ b/vendor/github.com/cs3org/reva/v2/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go @@ -810,53 +810,41 @@ func (s *service) ListContainer(ctx context.Context, req *provider.ListContainer return nil, errors.Wrap(err, "sharesstorageprovider: error calling ListReceivedSharesRequest") } - gatewayClient, err := s.gatewaySelector.Next() - if err != nil { - return nil, err - } - - infos := []*provider.ResourceInfo{} - for _, share := range receivedShares { - if share.GetState() != collaboration.ShareState_SHARE_STATE_ACCEPTED { + // Create map of shares that contains only the oldest share per shared resource. This is to avoid + // returning multiple resourceInfos for the same resource. But still be able to maintain a + // "somewhat" stable resourceID + oldestReceivedSharesByResourceID := make(map[string]*collaboration.ReceivedShare, len(receivedShares)) + for _, receivedShare := range receivedShares { + if receivedShare.GetState() != collaboration.ShareState_SHARE_STATE_ACCEPTED { continue } + rIDStr := storagespace.FormatResourceID(*receivedShare.GetShare().GetResourceId()) + if oldest, ok := oldestReceivedSharesByResourceID[rIDStr]; ok { + // replace if older than current oldest + if utils.TSToTime(receivedShare.GetShare().GetCtime()).Before(utils.TSToTime(oldest.GetShare().GetCtime())) { + oldestReceivedSharesByResourceID[rIDStr] = receivedShare + } + } else { + oldestReceivedSharesByResourceID[rIDStr] = receivedShare + } + } + // now compose the resourceInfos for the unified list of shares + infos := []*provider.ResourceInfo{} + for _, share := range oldestReceivedSharesByResourceID { info := shareMd[share.GetShare().GetId().GetOpaqueId()] if info == nil { - if share.GetShare().GetResourceId().GetSpaceId() == "" { - // convert backwards compatible share id - share.Share.ResourceId.StorageId, share.Share.ResourceId.SpaceId = storagespace.SplitStorageID(share.GetShare().GetResourceId().GetSpaceId()) - } - statRes, err := gatewayClient.Stat(ctx, &provider.StatRequest{ - Opaque: req.Opaque, - Ref: &provider.Reference{ - ResourceId: share.Share.ResourceId, - Path: ".", - }, - ArbitraryMetadataKeys: req.ArbitraryMetadataKeys, - }) - switch { - case err != nil: - appctx.GetLogger(ctx).Error(). - Err(err). - Interface("share", share). - Msg("sharesstorageprovider: could not make stat request when listing virtual root, skipping") - continue - case statRes.Status.Code != rpc.Code_CODE_OK: - appctx.GetLogger(ctx).Debug(). - Interface("share", share). - Interface("status", statRes.Status). - Msg("sharesstorageprovider: could not stat share when listing virtual root, skipping") - continue - } - info = statRes.Info + appctx.GetLogger(ctx).Debug(). + Interface("share", share). + Msg("sharesstorageprovider: no resource info for share") + continue } // override resource id info info.Id = &provider.ResourceId{ StorageId: utils.ShareStorageProviderID, SpaceId: utils.ShareStorageSpaceID, - OpaqueId: share.Share.Id.OpaqueId, + OpaqueId: share.GetShare().GetId().GetOpaqueId(), } info.Path = filepath.Base(share.MountPoint.Path) info.Name = info.Path diff --git a/vendor/modules.txt b/vendor/modules.txt index 71fb7154a12..4e3c376fc34 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -359,7 +359,7 @@ github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1 github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1 github.com/cs3org/go-cs3apis/cs3/tx/v1beta1 github.com/cs3org/go-cs3apis/cs3/types/v1beta1 -# github.com/cs3org/reva/v2 v2.18.1-0.20240221074425-cac6c6935c60 +# github.com/cs3org/reva/v2 v2.18.1-0.20240221074425-cac6c6935c60 => github.com/rhafer/reva/v2 v2.0.0-20240221095205-62cb6cd94e83 ## explicit; go 1.21 github.com/cs3org/reva/v2/cmd/revad/internal/grace github.com/cs3org/reva/v2/cmd/revad/runtime @@ -2337,3 +2337,4 @@ stash.kopano.io/kgol/rndm # github.com/go-micro/plugins/v4/store/nats-js-kv => github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20231207143248-4d424e3ae348 # github.com/studio-b12/gowebdav => github.com/aduffeck/gowebdav v0.0.0-20231215102054-212d4a4374f6 # github.com/egirna/icap-client => github.com/fschade/icap-client v0.0.0-20240123094924-5af178158eaf +# github.com/cs3org/reva/v2 => github.com/rhafer/reva/v2 v2.0.0-20240221095205-62cb6cd94e83