From c3e63413d4868bdf9b7c44786697f491ff7c067f Mon Sep 17 00:00:00 2001 From: ashmrtn <3891298+ashmrtn@users.noreply.github.com> Date: Wed, 20 Sep 2023 15:44:15 -0700 Subject: [PATCH] Fix extracting category from BaseCollection (#4323) #### Does this PR need a docs update or release note? - [ ] :white_check_mark: Yes, it's included - [ ] :clock1: Yes, but in a later PR - [x] :no_entry: No #### Type of change - [ ] :sunflower: Feature - [x] :bug: Bugfix - [ ] :world_map: Documentation - [ ] :robot: Supportability/Tests - [ ] :computer: CI/Deployment - [ ] :broom: Tech Debt/Cleanup #### Test Plan - [x] :muscle: Manual - [ ] :zap: Unit test - [ ] :green_heart: E2E --- .../m365/collection/exchange/collection.go | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) 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,