From 9405392b4facbec2fd690da2ae5d525cace3863c Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Sat, 30 Apr 2022 13:23:21 +0200 Subject: [PATCH] omit opaque id correctly --- extensions/graph/pkg/service/v0/drives.go | 6 +++++- extensions/graph/pkg/service/v0/graph_test.go | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/extensions/graph/pkg/service/v0/drives.go b/extensions/graph/pkg/service/v0/drives.go index 17f04e2df7c..a0a093d2ae4 100644 --- a/extensions/graph/pkg/service/v0/drives.go +++ b/extensions/graph/pkg/service/v0/drives.go @@ -512,7 +512,11 @@ func (g Graph) cs3StorageSpaceToDrive(ctx context.Context, baseURL *url.URL, spa spaceID := space.Root.StorageId sIDs := resourceid.OwnCloudResourceIDUnwrap(rootID) - if space.Root.OpaqueId != sIDs.OpaqueId { + sid := sIDs.GetStorageId() + if strings.Contains(sid, "$") { + sid, _ = resourceid.StorageIDUnwrap(sIDs.GetStorageId()) + } + if space.Root.OpaqueId != sid { spaceID = rootID } drive := &libregraph.Drive{ diff --git a/extensions/graph/pkg/service/v0/graph_test.go b/extensions/graph/pkg/service/v0/graph_test.go index fe328d93a6e..29fbb4621ea 100644 --- a/extensions/graph/pkg/service/v0/graph_test.go +++ b/extensions/graph/pkg/service/v0/graph_test.go @@ -196,7 +196,7 @@ var _ = Describe("Graph", func() { Id: &provider.StorageSpaceId{OpaqueId: "aID!differentID"}, SpaceType: "mountpoint", Root: &provider.ResourceId{ - StorageId: "aID", + StorageId: "prID$aID", OpaqueId: "differentID", }, Name: "New Folder", @@ -241,9 +241,9 @@ var _ = Describe("Graph", func() { value := response["value"][0] Expect(*value.DriveAlias).To(Equal("mountpoint/new-folder")) Expect(*value.DriveType).To(Equal("mountpoint")) - Expect(*value.Id).To(Equal("aID!differentID")) + Expect(*value.Id).To(Equal("prID$aID!differentID")) Expect(*value.Name).To(Equal("New Folder")) - Expect(*value.Root.WebDavUrl).To(Equal("https://localhost:9200/dav/spaces/aID!differentID")) + Expect(*value.Root.WebDavUrl).To(Equal("https://localhost:9200/dav/spaces/prID$aID!differentID")) Expect(*value.Root.ETag).To(Equal("101112131415")) Expect(*value.Root.Id).To(Equal("aID!differentID")) Expect(*value.Root.RemoteItem.ETag).To(Equal("123456789"))