From 926489d00456067975a870227171f933a272af22 Mon Sep 17 00:00:00 2001 From: Hitesh Pattanayak <48874082+HiteshRepo@users.noreply.github.com> Date: Sat, 23 Dec 2023 00:49:41 +0530 Subject: [PATCH] fix: integrate correct AddCategories (#4926) fixes duplication of AddCategories function. calls the correct AddCategories function #### Does this PR need a docs update or release note? - [x] :no_entry: No #### Type of change - [x] :bug: Bugfix #### Issue(s) #4754 #### Test Plan - [x] :muscle: Manual - [x] :zap: Unit test - [x] :green_heart: E2E --- src/cli/backup/sharepoint.go | 23 ++--------------------- src/cli/utils/sharepoint.go | 2 +- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/src/cli/backup/sharepoint.go b/src/cli/backup/sharepoint.go index edfd3f609..4ae2d1a68 100644 --- a/src/cli/backup/sharepoint.go +++ b/src/cli/backup/sharepoint.go @@ -226,30 +226,11 @@ func sharePointBackupCreateSelectors( sel := selectors.NewSharePointBackup(append(slices.Clone(sites), weburls...)) - return addCategories(sel, cats), nil + return utils.AddCategories(sel, cats), nil } func includeAllSitesWithCategories(ins idname.Cacher, categories []string) *selectors.SharePointBackup { - return addCategories(selectors.NewSharePointBackup(ins.IDs()), categories) -} - -func addCategories(sel *selectors.SharePointBackup, cats []string) *selectors.SharePointBackup { - // Issue #2631: Libraries are the only supported feature for SharePoint at this time. - if len(cats) == 0 { - sel.Include(sel.LibraryFolders(selectors.Any())) - } - - for _, d := range cats { - switch d { - // [TODO] uncomment when lists are enabled - // case flags.DataLists: - // sel.Include(sel.Lists(selectors.Any())) - case flags.DataLibraries: - sel.Include(sel.LibraryFolders(selectors.Any())) - } - } - - return sel + return utils.AddCategories(selectors.NewSharePointBackup(ins.IDs()), categories) } // ------------------------------------------------------------------------------------------------ diff --git a/src/cli/utils/sharepoint.go b/src/cli/utils/sharepoint.go index 0a028fe94..0c164c579 100644 --- a/src/cli/utils/sharepoint.go +++ b/src/cli/utils/sharepoint.go @@ -69,7 +69,7 @@ func MakeSharePointOpts(cmd *cobra.Command) SharePointOpts { func SharePointAllowedCategories() map[string]struct{} { return map[string]struct{}{ flags.DataLibraries: {}, - // flags.DataLists: {}, + // flags.DataLists: {}, [TODO]: uncomment when lists are enabled } }