From a28f57a6dee56cb144b57c944512d803ff261937 Mon Sep 17 00:00:00 2001 From: Abin Simon Date: Thu, 21 Sep 2023 10:35:11 +0530 Subject: [PATCH] Use HumanString for export folder names (#4276) `Libraries` is what gets used for SP libraries and using `channelMessages` here did not look good. Ref: https://github.com/alcionai/corso/blob/fe77c30e849307274d7d7f6570260fb6fab2a622/src/internal/m365/service/sharepoint/export.go#L49-L52 --- #### 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 - [ ] :bug: Bugfix - [ ] :world_map: Documentation - [ ] :robot: Supportability/Tests - [ ] :computer: CI/Deployment - [x] :broom: Tech Debt/Cleanup #### Issue(s) * # #### Test Plan - [x] :muscle: Manual - [ ] :zap: Unit test - [ ] :green_heart: E2E --- src/internal/m365/service/groups/export.go | 10 +++++----- src/internal/m365/service/groups/export_test.go | 2 +- src/internal/m365/service/sharepoint/export.go | 2 +- src/internal/m365/service/sharepoint/export_test.go | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/internal/m365/service/groups/export.go b/src/internal/m365/service/groups/export.go index be433493f..f4345d0ba 100644 --- a/src/internal/m365/service/groups/export.go +++ b/src/internal/m365/service/groups/export.go @@ -40,7 +40,7 @@ func ProduceExportCollections( var ( fp = restoreColl.FullPath() cat = fp.Category() - folders = []string{cat.String()} + folders = []string{cat.HumanString()} coll export.Collectioner ) @@ -66,13 +66,13 @@ func ProduceExportCollections( driveName = drivePath.DriveID } - folders := restoreColl.FullPath().Folders() - siteName := folders[1] // use siteID by default + rfds := restoreColl.FullPath().Folders() + siteName := rfds[1] // use siteID by default webURL, ok := backupSiteIDWebURL.NameOf(siteName) if !ok { // This should not happen, but just in case - logger.Ctx(ctx).With("site_id", folders[1]).Info("site weburl not found, using site id") + logger.Ctx(ctx).With("site_id", rfds[1]).Info("site weburl not found, using site id") } if len(webURL) != 0 { @@ -83,7 +83,7 @@ func ProduceExportCollections( } baseDir := path.Builder{}. - Append("Libraries"). + Append(folders...). Append(siteName). Append(driveName). Append(drivePath.Folders...) diff --git a/src/internal/m365/service/groups/export_test.go b/src/internal/m365/service/groups/export_test.go index a621760ac..ffcc54c9b 100644 --- a/src/internal/m365/service/groups/export_test.go +++ b/src/internal/m365/service/groups/export_test.go @@ -67,7 +67,7 @@ func (suite *ExportUnitSuite) TestExportRestoreCollections_messages() { body = io.NopCloser(bytes.NewBufferString( `{"displayname": "` + dii.Groups.ItemName + `"}`)) exportCfg = control.ExportConfig{} - expectedPath = path.ChannelMessagesCategory.String() + "/" + containerName + expectedPath = path.ChannelMessagesCategory.HumanString() + "/" + containerName expectedItems = []export.Item{ { ID: itemID, diff --git a/src/internal/m365/service/sharepoint/export.go b/src/internal/m365/service/sharepoint/export.go index 0078f085a..7eb840bb7 100644 --- a/src/internal/m365/service/sharepoint/export.go +++ b/src/internal/m365/service/sharepoint/export.go @@ -47,7 +47,7 @@ func ProduceExportCollections( } baseDir := path.Builder{}. - Append("Libraries"). + Append(path.LibrariesCategory.HumanString()). Append(driveName). Append(drivePath.Folders...) diff --git a/src/internal/m365/service/sharepoint/export_test.go b/src/internal/m365/service/sharepoint/export_test.go index e2afbe680..6becb725a 100644 --- a/src/internal/m365/service/sharepoint/export_test.go +++ b/src/internal/m365/service/sharepoint/export_test.go @@ -67,7 +67,7 @@ func (suite *ExportUnitSuite) TestExportRestoreCollections() { // Cache check with lowercased ids map[string]string{strings.ToLower(driveID): driveName}) dii = odStub.DriveItemInfo() - expectedPath = "Libraries/" + driveName + expectedPath = path.LibrariesCategory.HumanString() + "/" + driveName expectedItems = []export.Item{ { ID: "id1.data",