Skip to content

Commit

Permalink
omit opaque id correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
micbar committed Apr 30, 2022
1 parent 254ac50 commit 9405392
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion extensions/graph/pkg/service/v0/drives.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
6 changes: 3 additions & 3 deletions extensions/graph/pkg/service/v0/graph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"))
Expand Down

0 comments on commit 9405392

Please sign in to comment.