From 78a6af3af5c2fe954dac97afa2e2309d690cf225 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Fri, 29 Apr 2022 21:31:04 +0200 Subject: [PATCH] handle resource ids better --- extensions/graph/pkg/service/v0/drives.go | 9 ++++++--- go.mod | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/extensions/graph/pkg/service/v0/drives.go b/extensions/graph/pkg/service/v0/drives.go index 673f246fa5..e41b425329 100644 --- a/extensions/graph/pkg/service/v0/drives.go +++ b/extensions/graph/pkg/service/v0/drives.go @@ -273,7 +273,8 @@ func (g Graph) UpdateDrive(w http.ResponseWriter, r *http.Request) { identifierParts := strings.Split(driveID, "!") switch len(identifierParts) { case 1: - root.StorageId, root.OpaqueId = identifierParts[0], identifierParts[0] + sID, _ := resourceid.StorageIDUnwrap(identifierParts[0]) + root.StorageId, root.OpaqueId = identifierParts[0], sID case 2: root.StorageId, root.OpaqueId = identifierParts[0], identifierParts[1] default: @@ -492,7 +493,8 @@ func (g Graph) cs3StorageSpaceToDrive(ctx context.Context, baseURL *url.URL, spa } spaceID := space.Root.StorageId - if space.Root.OpaqueId != space.Root.StorageId { + sIDs := resourceid.OwnCloudResourceIDUnwrap(rootID) + if space.Root.OpaqueId != sIDs.OpaqueId { spaceID = rootID } drive := &libregraph.Drive{ @@ -735,9 +737,10 @@ func (g Graph) DeleteDrive(w http.ResponseWriter, r *http.Request) { root := &storageprovider.ResourceId{} identifierParts := strings.Split(driveID, "!") + sID, _ := resourceid.StorageIDUnwrap(identifierParts[0]) switch len(identifierParts) { case 1: - root.StorageId, root.OpaqueId = identifierParts[0], identifierParts[0] + root.StorageId, root.OpaqueId = identifierParts[0], sID case 2: root.StorageId, root.OpaqueId = identifierParts[0], identifierParts[1] default: diff --git a/go.mod b/go.mod index 7392fe8e00..0a040a2031 100644 --- a/go.mod +++ b/go.mod @@ -274,3 +274,4 @@ require ( // we need to use a fork to make the windows build pass replace github.com/pkg/xattr => github.com/micbar/xattr v0.4.6-0.20220215112335-88e74d648fb7 +replace github.com/cs3org/reva/v2 => ../reva