From c932df0252a0271985441947739a346b7fcbe9b8 Mon Sep 17 00:00:00 2001 From: Abhishek Pandey Date: Thu, 30 Nov 2023 18:37:08 -0800 Subject: [PATCH] Do conversion inside collections.Add --- src/internal/m365/collection/drive/collection.go | 5 +++-- src/internal/m365/collection/drive/collections.go | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/internal/m365/collection/drive/collection.go b/src/internal/m365/collection/drive/collection.go index 65cb09077..34997c9ce 100644 --- a/src/internal/m365/collection/drive/collection.go +++ b/src/internal/m365/collection/drive/collection.go @@ -10,6 +10,7 @@ import ( "time" "github.com/alcionai/clues" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/spatialcurrent/go-lazy/pkg/lazy" "github.com/alcionai/corso/src/internal/common/idname" @@ -193,11 +194,11 @@ func newColl( // Adds an itemID to the collection. This will make it eligible to be // populated. The return values denotes if the item was previously // present or is new one. -func (oc *Collection) Add(cdi CorsoDriveItemable) bool { +func (oc *Collection) Add(item models.DriveItemable) bool { // _, found := oc.driveItems[ptr.Val(item.GetId())] // oc.driveItems[ptr.Val(item.GetId())] = item - //cdi := ToCorsoDriveItemable(item) + cdi := ToCorsoDriveItemable(item) _, found := oc.driveItems[ptr.Val(cdi.GetId())] oc.driveItems[ptr.Val(cdi.GetId())] = cdi diff --git a/src/internal/m365/collection/drive/collections.go b/src/internal/m365/collection/drive/collections.go index 76f24f7a8..023e1cc90 100644 --- a/src/internal/m365/collection/drive/collections.go +++ b/src/internal/m365/collection/drive/collections.go @@ -696,7 +696,7 @@ func (c *Collections) handleDelete( func (c *Collections) getCollectionPath( driveID string, - item CorsoDriveItemable, + item models.DriveItemable, ) (path.Path, error) { var ( pb = odConsts.DriveFolderPrefixBuilder(driveID) @@ -845,7 +845,7 @@ func (c *Collections) PopulateDriveCollections( func (c *Collections) processItem( ctx context.Context, - di models.DriveItemable, + item models.DriveItemable, driveID, driveName string, oldPrevPaths, currPrevPaths, newPrevPaths map[string]string, seenFolders map[string]string, @@ -855,7 +855,7 @@ func (c *Collections) processItem( counter *count.Bus, skipper fault.AddSkipper, ) error { - item := ToCorsoDriveItemable(di) + // item := ToCorsoDriveItemable(di) var ( itemID = ptr.Val(item.GetId()) @@ -870,7 +870,7 @@ func (c *Collections) processItem( "item_is_folder", isFolder) if item.GetMalware() != nil { - addtl := graph.ItemInfo(di) + addtl := graph.ItemInfo(item) skip := fault.FileSkip(fault.SkipMalware, driveID, itemID, itemName, addtl) if isFolder {