From 6e68d2278e7e7e46e17f78d6707fc59ca2b8b5bd Mon Sep 17 00:00:00 2001 From: Gianmaria Del Monte Date: Fri, 1 Dec 2023 13:50:37 +0100 Subject: [PATCH] new item id for ocs --- internal/http/services/owncloud/ocgraph/drives.go | 3 ++- .../owncloud/ocs/handlers/apps/sharing/shares/shares.go | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/http/services/owncloud/ocgraph/drives.go b/internal/http/services/owncloud/ocgraph/drives.go index a8511bd6a5..2ef8bc9fd7 100644 --- a/internal/http/services/owncloud/ocgraph/drives.go +++ b/internal/http/services/owncloud/ocgraph/drives.go @@ -40,6 +40,7 @@ import ( "github.com/cs3org/reva/pkg/appctx" "github.com/cs3org/reva/pkg/spaces" "github.com/cs3org/reva/pkg/utils/list" + "github.com/cs3org/reva/pkg/utils/resourceid" libregraph "github.com/owncloud/libre-graph-api-go" "github.com/pkg/errors" ) @@ -149,7 +150,7 @@ func getDrivesForShares(ctx context.Context, gw gateway.GatewayAPIClient) ([]*li // the prefix of the remote_item.id and rootid idPrefix := base32.StdEncoding.EncodeToString([]byte(fmt.Sprintf("#s%s", stat.Info.Path))) - resourceIdEnc := base32.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s!%s", stat.Info.Id.StorageId, stat.Info.Id.OpaqueId))) + resourceIdEnc := base32.StdEncoding.EncodeToString([]byte(resourceid.OwnCloudResourceIDWrap(stat.Info.Id))) space := &libregraph.Drive{ Id: libregraph.PtrString(fmt.Sprintf("%s$%s!%s", shareJailID, shareJailID, share.Id.OpaqueId)), diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go index 79ee760c23..c0de4e3f35 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go @@ -21,6 +21,7 @@ package shares import ( "bytes" "context" + "encoding/base32" "encoding/json" "fmt" "mime" @@ -1146,7 +1147,10 @@ func (h *Handler) addFileInfo(ctx context.Context, s *conversions.ShareData, inf s.MimeType = parsedMt // TODO STime: &types.Timestamp{Seconds: info.Mtime.Seconds, Nanos: info.Mtime.Nanos}, // TODO Storage: int - s.ItemSource = resourceid.OwnCloudResourceIDWrap(info.Id) + itemID := base32.StdEncoding.EncodeToString([]byte(fmt.Sprintf("#s%s", info.Path))) + itemID += "!" + base32.StdEncoding.EncodeToString([]byte(resourceid.OwnCloudResourceIDWrap(info.Id))) + + s.ItemSource = itemID s.FileSource = s.ItemSource switch { case h.sharePrefix == "/":