Folder display name fix (#3062)
Fixes folder display names in backup details. They got off when locations were switched to returning path builders instead of full paths --- #### Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No #### Type of change - [ ] 🌻 Feature - [x] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup #### Issue - closes #3061 #### Test Plan - [x] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
3cc29649ed
commit
dae79f4acf
@ -2,7 +2,6 @@ package backup
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/pkg/errors"
|
||||
@ -170,8 +169,6 @@ func createExchangeCmd(cmd *cobra.Command, args []string) error {
|
||||
return Only(ctx, clues.Wrap(err, "Failed to retrieve M365 users"))
|
||||
}
|
||||
|
||||
fmt.Printf("\n-----\nINS %+v\n-----\n", ins)
|
||||
|
||||
selectorSet := []selectors.Selector{}
|
||||
|
||||
for _, discSel := range sel.SplitByResourceOwner(ins.IDs()) {
|
||||
|
||||
@ -171,7 +171,7 @@ func (b *Builder) Details() *Details {
|
||||
// AddFoldersForItem, and unexport AddFoldersForItem.
|
||||
func FolderEntriesForPath(parent, location *path.Builder) []folderEntry {
|
||||
folders := []folderEntry{}
|
||||
lfs := locationRefOf(location)
|
||||
lfs := location
|
||||
|
||||
for len(parent.Elements()) > 0 {
|
||||
var (
|
||||
@ -213,21 +213,6 @@ func FolderEntriesForPath(parent, location *path.Builder) []folderEntry {
|
||||
return folders
|
||||
}
|
||||
|
||||
// assumes the pb contains a path like:
|
||||
// <tenant>/<service>/<owner>/<category>/<logical_containers>...
|
||||
// and returns a string with only <logical_containers>/...
|
||||
func locationRefOf(pb *path.Builder) *path.Builder {
|
||||
if pb == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < 4; i++ {
|
||||
pb = pb.PopFront()
|
||||
}
|
||||
|
||||
return pb
|
||||
}
|
||||
|
||||
// AddFoldersForItem adds entries for the given folders. It skips adding entries that
|
||||
// have been added by previous calls.
|
||||
func (b *Builder) AddFoldersForItem(folders []folderEntry, itemInfo ItemInfo, updated bool) {
|
||||
|
||||
@ -1138,12 +1138,6 @@ func (suite *DetailsUnitSuite) TestFolderEntriesForPath() {
|
||||
parent: basePath,
|
||||
expect: baseFolderEnts,
|
||||
},
|
||||
{
|
||||
name: "base path with location",
|
||||
parent: basePath,
|
||||
location: basePath,
|
||||
expect: baseFolderEnts,
|
||||
},
|
||||
{
|
||||
name: "single depth parent only",
|
||||
parent: basePath.Append(fnords...),
|
||||
@ -1152,7 +1146,7 @@ func (suite *DetailsUnitSuite) TestFolderEntriesForPath() {
|
||||
{
|
||||
name: "single depth with location",
|
||||
parent: basePath.Append(fnords...),
|
||||
location: basePath.Append(beau...),
|
||||
location: path.Builder{}.Append(beau...),
|
||||
expect: folderEntriesFor(fnords, beau),
|
||||
},
|
||||
{
|
||||
@ -1163,13 +1157,13 @@ func (suite *DetailsUnitSuite) TestFolderEntriesForPath() {
|
||||
{
|
||||
name: "two depth with location",
|
||||
parent: basePath.Append(smarf...),
|
||||
location: basePath.Append(regard...),
|
||||
location: path.Builder{}.Append(regard...),
|
||||
expect: folderEntriesFor(smarf, regard),
|
||||
},
|
||||
{
|
||||
name: "mismatched depth, parent longer",
|
||||
parent: basePath.Append(smarf...),
|
||||
location: basePath.Append(beau...),
|
||||
location: path.Builder{}.Append(beau...),
|
||||
expect: folderEntriesFor(smarf, beau),
|
||||
},
|
||||
// We can't handle this right now. But we don't have any cases
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user