diff --git a/src/internal/converters/eml/eml.go b/src/internal/converters/eml/eml.go index e6a022282..3f1421a13 100644 --- a/src/internal/converters/eml/eml.go +++ b/src/internal/converters/eml/eml.go @@ -44,7 +44,7 @@ func FromJSON(ctx context.Context, body []byte) (string, error) { return "", clues.Wrap(err, "converting to messageble") } - ctx = clues.Add(ctx, "id", ptr.Val(data.GetId())) + ctx = clues.Add(ctx, "item_id", ptr.Val(data.GetId())) email := mail.NewMSG() email.AllowDuplicateAddress = true // More "correct" conversion diff --git a/src/internal/m365/collection/exchange/export.go b/src/internal/m365/collection/exchange/export.go index c3e761a2c..59f24a527 100644 --- a/src/internal/m365/collection/exchange/export.go +++ b/src/internal/m365/collection/exchange/export.go @@ -44,7 +44,9 @@ func streamItems( errs := fault.New(false) for _, rc := range drc { - for item := range rc.Items(ctx, errs) { + ictx := clues.Add(ctx, "path_short_ref", rc.FullPath().ShortRef()) + + for item := range rc.Items(ictx, errs) { id := item.ID() name := id + ".eml" @@ -64,7 +66,7 @@ func streamItems( continue } - email, err := eml.FromJSON(ctx, content) + email, err := eml.FromJSON(ictx, content) if err != nil { ch <- export.Item{ ID: id, diff --git a/src/internal/m365/service/exchange/export_test.go b/src/internal/m365/service/exchange/export_test.go index cfae24096..995b231db 100644 --- a/src/internal/m365/service/exchange/export_test.go +++ b/src/internal/m365/service/exchange/export_test.go @@ -33,6 +33,10 @@ func TestExportUnitSuite(t *testing.T) { func (suite *ExportUnitSuite) TestGetItems() { emailBodyBytes := []byte(testdata.EmailWithAttachments) + pb := path.Builder{}.Append("Inbox") + p, err := pb.ToDataLayerPath("t", "r", path.ExchangeService, path.EmailCategory, false) + assert.NoError(suite.T(), err, "build path") + table := []struct { name string version int @@ -44,6 +48,7 @@ func (suite *ExportUnitSuite) TestGetItems() { version: 1, backingCollection: data.NoFetchRestoreCollection{ Collection: dataMock.Collection{ + Path: p, ItemData: []data.Item{ &dataMock.Item{ ItemID: "id1", @@ -65,6 +70,7 @@ func (suite *ExportUnitSuite) TestGetItems() { version: 1, backingCollection: data.NoFetchRestoreCollection{ Collection: dataMock.Collection{ + Path: p, ItemData: []data.Item{ &dataMock.Item{ ItemID: "id1", @@ -95,6 +101,7 @@ func (suite *ExportUnitSuite) TestGetItems() { version: version.Groups9Update, backingCollection: data.FetchRestoreCollection{ Collection: dataMock.Collection{ + Path: p, ItemData: []data.Item{ &dataMock.Item{ ItemID: "id0",