diff --git a/src/internal/m365/collection/exchange/collection.go b/src/internal/m365/collection/exchange/collection.go index a7278029d..62ceb1c45 100644 --- a/src/internal/m365/collection/exchange/collection.go +++ b/src/internal/m365/collection/exchange/collection.go @@ -186,17 +186,25 @@ func (col *prefetchCollection) streamItems( errs *fault.Bus, ) { var ( + category path.CategoryType success int64 totalBytes int64 wg sync.WaitGroup colProgress chan<- struct{} user = col.user - log = logger.Ctx(ctx).With( - "service", path.ExchangeService.String(), - "category", col.FullPath().Category().String()) ) + if col.FullPath() != nil { + category = col.FullPath().Category() + } else { + category = col.PreviousPath().Category() + } + + log := logger.Ctx(ctx).With( + "service", path.ExchangeService.String(), + "category", category.String()) + defer func() { close(stream) updateStatus( @@ -346,12 +354,19 @@ func (col *lazyFetchCollection) streamItems( errs *fault.Bus, ) { var ( + category path.CategoryType success int64 colProgress chan<- struct{} user = col.user ) + if col.FullPath() != nil { + category = col.FullPath().Category() + } else { + category = col.PreviousPath().Category() + } + defer func() { close(stream) updateStatus( @@ -400,7 +415,7 @@ func (col *lazyFetchCollection) streamItems( "item_id", id, "parent_path", path.LoggableDir(parentPath), "service", path.ExchangeService.String(), - "category", col.FullPath().Category().String()) + "category", category.String()) stream <- &lazyItem{ ctx: ictx,