This commit is contained in:
Vaibhav Kamra 2023-03-07 19:13:08 -08:00
parent c2330e7262
commit e9ef8eb69d

View File

@ -405,33 +405,33 @@ func constructWebURL(adtl map[string]any) string {
return url return url
} }
func fetchParentReference( // func fetchParentReference(
ctx context.Context, // ctx context.Context,
service graph.Servicer, // service graph.Servicer,
orig models.ItemReferenceable, // orig models.ItemReferenceable,
) (models.ItemReferenceable, error) { // ) (models.ItemReferenceable, error) {
if orig == nil || service == nil || ptr.Val(orig.GetName()) != "" { // if orig == nil || service == nil || ptr.Val(orig.GetName()) != "" {
return orig, nil // return orig, nil
} // }
options := &msdrives.DriveItemRequestBuilderGetRequestConfiguration{ // options := &msdrives.DriveItemRequestBuilderGetRequestConfiguration{
QueryParameters: &msdrives.DriveItemRequestBuilderGetQueryParameters{ // QueryParameters: &msdrives.DriveItemRequestBuilderGetQueryParameters{
Select: []string{"name"}, // Select: []string{"name"},
}, // },
} // }
driveID := ptr.Val(orig.GetDriveId()) // driveID := ptr.Val(orig.GetDriveId())
if driveID == "" { // if driveID == "" {
return orig, nil // return orig, nil
} // }
drive, err := service.Client().DrivesById(driveID).Get(ctx, options) // drive, err := service.Client().DrivesById(driveID).Get(ctx, options)
if err != nil { // if err != nil {
return nil, clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...) // return nil, graph.Stack(ctx, err)
} // }
orig.SetName(drive.GetName()) // orig.SetName(drive.GetName())
return orig, nil // return orig, nil
} // }