From e2e2012220828966de5f8d9f16696da4de0ba772 Mon Sep 17 00:00:00 2001 From: Abin Simon Date: Thu, 2 Nov 2023 20:10:57 +0530 Subject: [PATCH] Use .json extension for message exports (#4600) We were previously exporting json but without the proper file extension. --- #### Does this PR need a docs update or release note? - [x] :white_check_mark: Yes, it's included - [ ] :clock1: Yes, but in a later PR - [ ] :no_entry: No #### Type of change - [ ] :sunflower: Feature - [x] :bug: Bugfix - [ ] :world_map: Documentation - [ ] :robot: Supportability/Tests - [ ] :computer: CI/Deployment - [ ] :broom: Tech Debt/Cleanup #### Issue(s) * closes https://github.com/alcionai/corso/issues/4581 #### Test Plan - [ ] :muscle: Manual - [x] :zap: Unit test - [ ] :green_heart: E2E --- CHANGELOG.md | 3 +++ src/internal/m365/collection/groups/export.go | 8 +++++--- src/internal/m365/collection/groups/export_test.go | 4 ++-- src/internal/m365/service/groups/export_test.go | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dae857aa..0a9719901 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] (beta) +### Changed +- Change file extension of messages export to json to match the content + ## [v0.15.0] (beta) - 2023-10-31 ### Added diff --git a/src/internal/m365/collection/groups/export.go b/src/internal/m365/collection/groups/export.go index f2b0b6d76..468cf1472 100644 --- a/src/internal/m365/collection/groups/export.go +++ b/src/internal/m365/collection/groups/export.go @@ -61,10 +61,12 @@ func streamItems( stats.UpdateResourceCount(path.ChannelMessagesCategory) body = data.ReaderWithStats(body, path.ChannelMessagesCategory, stats) + // messages are exported as json and should be named as such + name := item.ID() + ".json" + ch <- export.Item{ - ID: item.ID(), - // channel message items have no name - Name: item.ID(), + ID: item.ID(), + Name: name, Body: body, } } diff --git a/src/internal/m365/collection/groups/export_test.go b/src/internal/m365/collection/groups/export_test.go index 34430ba77..298154bec 100644 --- a/src/internal/m365/collection/groups/export_test.go +++ b/src/internal/m365/collection/groups/export_test.go @@ -46,7 +46,7 @@ func (suite *ExportUnitSuite) TestStreamItems() { }, }, }, - expectName: "zim", + expectName: "zim.json", expectErr: assert.NoError, }, { @@ -71,7 +71,7 @@ func (suite *ExportUnitSuite) TestStreamItems() { clues.New("I miss my cupcake."), }, }, - expectName: "gir", + expectName: "gir.json", expectErr: assert.Error, }, } diff --git a/src/internal/m365/service/groups/export_test.go b/src/internal/m365/service/groups/export_test.go index 35d4356fd..d2f1de8e2 100644 --- a/src/internal/m365/service/groups/export_test.go +++ b/src/internal/m365/service/groups/export_test.go @@ -70,7 +70,7 @@ func (suite *ExportUnitSuite) TestExportRestoreCollections_messages() { expectedItems = []export.Item{ { ID: itemID, - Name: dii.Groups.ItemName, + Name: dii.Groups.ItemName + ".json", // Body: body, not checked }, }