From b0538559c257a6f0ddf80688aabb7b36cf1a744a Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Wed, 18 Oct 2023 14:18:30 +0200 Subject: [PATCH] graph: Populate 'ParentRef' in driveitems --- services/graph/pkg/service/v0/driveitems.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/graph/pkg/service/v0/driveitems.go b/services/graph/pkg/service/v0/driveitems.go index 322abfdb04..f8028bc711 100644 --- a/services/graph/pkg/service/v0/driveitems.go +++ b/services/graph/pkg/service/v0/driveitems.go @@ -325,6 +325,13 @@ func cs3ResourceToDriveItem(logger *log.Logger, res *storageprovider.ResourceInf lastModified := cs3TimestampToTime(res.Mtime) driveItem.LastModifiedDateTime = &lastModified } + if res.ParentId != nil { + parentRef := libregraph.NewItemReference() + parentRef.SetDriveType(res.Space.SpaceType) + parentRef.SetDriveId(storagespace.FormatStorageID(res.ParentId.StorageId, res.ParentId.SpaceId)) + parentRef.SetId(storagespace.FormatResourceID(*res.ParentId)) + driveItem.ParentReference = parentRef + } if res.Type == storageprovider.ResourceType_RESOURCE_TYPE_FILE && res.MimeType != "" { // We cannot use a libregraph.File here because the openapi codegenerator autodetects 'File' as a go type ... driveItem.File = &libregraph.OpenGraphFile{