Fallback to RepoRef is LocationRef is empty (#3270)

Fixes issue where doing backup detail or a restore
on an older backup and selecting by folder in
exchange wouldn't return any results. Root cause
is that older backup versions didn't populate
LocationRef in backup details which is what we
compare against

Manually tested on an older Corso backup. Will
write automated unit tests in a bit, wanted to
get this in prior to release

---

#### 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)

* closes #3269

#### Test Plan

- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
This commit is contained in:
ashmrtn 2023-05-01 10:13:49 -07:00 committed by GitHub
parent 213bac60e2
commit c3cc40176e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Drives with a directory containing a folder named 'folder' will now restore without error. - Drives with a directory containing a folder named 'folder' will now restore without error.
- The CORSO_LOG_FILE env is appropriately utilized if no --log-file flag is provided. - The CORSO_LOG_FILE env is appropriately utilized if no --log-file flag is provided.
- Fixed Exchange events progress output to show calendar names instead of IDs. - Fixed Exchange events progress output to show calendar names instead of IDs.
- Fixed reporting no items match if restoring or listing details on an older Exchange backup and filtering by folder.
### Known Issues ### Known Issues
- Restoring a OneDrive or SharePoint file with the same name as a file with that name as its M365 ID may restore both items. - Restoring a OneDrive or SharePoint file with the same name as a file with that name as its M365 ID may restore both items.

View File

@ -617,8 +617,15 @@ func (ec exchangeCategory) pathValues(
item = repo.Item() item = repo.Item()
} }
// Will hit the if-condition when we're at a top-level folder, but we'll get
// the same result when we extract from the RepoRef.
folder := ent.LocationRef
if len(folder) == 0 {
folder = repo.Folder(true)
}
result := map[categorizer][]string{ result := map[categorizer][]string{
folderCat: {ent.LocationRef}, folderCat: {folder},
itemCat: {item, ent.ShortRef}, itemCat: {item, ent.ShortRef},
} }