From 6b8b500df024bb8998f9f45c315b9240130400e4 Mon Sep 17 00:00:00 2001 From: neha_gupta Date: Sat, 16 Sep 2023 00:09:04 +0530 Subject: [PATCH] handle path for channel (#4257) Handle the path creation for Onedrive and Channel. #### Does this PR need a docs update or release note? - [ ] :no_entry: No #### Type of change - [ ] :bug: Bugfix #### Issue(s) * # #### Test Plan - [ ] :muscle: Manual --- src/internal/m365/service/onedrive/restore.go | 9 +++++++++ .../pathtransformer/restore_path_transformer.go | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/internal/m365/service/onedrive/restore.go b/src/internal/m365/service/onedrive/restore.go index a1dc65182..b71626663 100644 --- a/src/internal/m365/service/onedrive/restore.go +++ b/src/internal/m365/service/onedrive/restore.go @@ -109,7 +109,16 @@ func AugmentRestorePaths( // of the directory. colPaths := map[string]path.RestorePaths{} + allowedCategories := map[path.CategoryType]struct{}{ + path.LibrariesCategory: {}, + path.FilesCategory: {}, + } + for _, p := range paths { + if _, ok := allowedCategories[p.StoragePath.Category()]; !ok { + continue + } + first := true for { diff --git a/src/internal/operations/pathtransformer/restore_path_transformer.go b/src/internal/operations/pathtransformer/restore_path_transformer.go index a618deedd..5d7a750c2 100644 --- a/src/internal/operations/pathtransformer/restore_path_transformer.go +++ b/src/internal/operations/pathtransformer/restore_path_transformer.go @@ -143,7 +143,8 @@ func makeRestorePathsForEntry( // * Exchange Email/Contacts // * OneDrive/SharePoint (needs drive information) switch true { - case ent.Exchange != nil: + case ent.Exchange != nil || + (ent.Groups != nil && ent.Groups.ItemType == details.GroupsChannelMessage): // TODO(ashmrtn): Eventually make Events have it's own function to handle // setting the restore destination properly. res.RestorePath, err = basicLocationPath(repoRef, locRef)