Return SharePoint exclude information (#3242)
Allows proper deletion of files and also fixes file moves. --- #### Does this PR need a docs update or release note? - [x] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [ ] ⛔ No #### Type of change - [ ] 🌻 Feature - [x] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup #### Issue(s) * #3240 #### Test Plan - [x] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
ca9425a329
commit
b8e868c05b
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/alcionai/clues"
|
"github.com/alcionai/clues"
|
||||||
|
"golang.org/x/exp/maps"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common/idname"
|
"github.com/alcionai/corso/src/internal/common/idname"
|
||||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||||
@ -53,6 +54,7 @@ func DataCollections(
|
|||||||
el = errs.Local()
|
el = errs.Local()
|
||||||
collections = []data.BackupCollection{}
|
collections = []data.BackupCollection{}
|
||||||
categories = map[path.CategoryType]struct{}{}
|
categories = map[path.CategoryType]struct{}{}
|
||||||
|
excluded = map[string]map[string]struct{}{}
|
||||||
)
|
)
|
||||||
|
|
||||||
for _, scope := range b.Scopes() {
|
for _, scope := range b.Scopes() {
|
||||||
@ -84,7 +86,9 @@ func DataCollections(
|
|||||||
}
|
}
|
||||||
|
|
||||||
case path.LibrariesCategory:
|
case path.LibrariesCategory:
|
||||||
spcs, _, err = collectLibraries(
|
var excludes map[string]map[string]struct{}
|
||||||
|
|
||||||
|
spcs, excludes, err = collectLibraries(
|
||||||
ctx,
|
ctx,
|
||||||
itemClient,
|
itemClient,
|
||||||
serv,
|
serv,
|
||||||
@ -100,6 +104,14 @@ func DataCollections(
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for prefix, excludes := range excludes {
|
||||||
|
if _, ok := excluded[prefix]; !ok {
|
||||||
|
excluded[prefix] = map[string]struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
maps.Copy(excluded[prefix], excludes)
|
||||||
|
}
|
||||||
|
|
||||||
case path.PagesCategory:
|
case path.PagesCategory:
|
||||||
spcs, err = collectPages(
|
spcs, err = collectPages(
|
||||||
ctx,
|
ctx,
|
||||||
@ -138,7 +150,7 @@ func DataCollections(
|
|||||||
collections = append(collections, baseCols...)
|
collections = append(collections, baseCols...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return collections, nil, el.Failure()
|
return collections, excluded, el.Failure()
|
||||||
}
|
}
|
||||||
|
|
||||||
func collectLists(
|
func collectLists(
|
||||||
@ -216,8 +228,6 @@ func collectLibraries(
|
|||||||
ctrlOpts)
|
ctrlOpts)
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO(ashmrtn): Pass previous backup metadata when SharePoint supports delta
|
|
||||||
// token-based incrementals.
|
|
||||||
odcs, excludes, err := colls.Get(ctx, metadata, errs)
|
odcs, excludes, err := colls.Get(ctx, metadata, errs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, graph.Wrap(ctx, err, "getting library")
|
return nil, nil, graph.Wrap(ctx, err, "getting library")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user