From 1945db6b65827e6dd6d57de8ac42fe4a119db685 Mon Sep 17 00:00:00 2001 From: Keepers Date: Mon, 27 Feb 2023 15:46:55 -0700 Subject: [PATCH] force omission of meta files (#2662) While the `isMeta` flag will solve this in the future, the current state requires us to filter out all meta and dirmeta files, even historically. --- #### Does this PR need a docs update or release note? - [x] :white_check_mark: Yes, it's included #### Type of change - [x] :bug: Bugfix #### Issue(s) * #1970 #### Test Plan - [x] :zap: Unit test - [x] :green_heart: E2E --- CHANGELOG.md | 1 + src/pkg/backup/details/details.go | 9 ++++++++- src/pkg/backup/details/details_test.go | 10 +++++----- website/docs/support/known-issues.md | 3 ++- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb25867b3..179a39184 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Known Issues - Folders and Calendars containing zero items or subfolders are not included in the backup. +- OneDrive files ending in `.meta` or `.dirmeta` are omitted from details and restores. ## [v0.4.0] (beta) - 2023-2-20 diff --git a/src/pkg/backup/details/details.go b/src/pkg/backup/details/details.go index c713c445f..74ce380d2 100644 --- a/src/pkg/backup/details/details.go +++ b/src/pkg/backup/details/details.go @@ -3,6 +3,7 @@ package details import ( "context" "strconv" + "strings" "sync" "time" @@ -127,7 +128,13 @@ func (dm DetailsModel) FilterMetaFiles() DetailsModel { // additional data like permissions in case of OneDrive and are not to // be treated as regular files. func (de DetailsEntry) isMetaFile() bool { - return de.ItemInfo.OneDrive != nil && de.ItemInfo.OneDrive.IsMeta + if de.ItemInfo.OneDrive == nil { + return false + } + + return de.ItemInfo.OneDrive.IsMeta || + strings.HasSuffix(de.RepoRef, ".meta") || + strings.HasSuffix(de.RepoRef, ".dirmeta") } // --------------------------------------------------------------------------- diff --git a/src/pkg/backup/details/details_test.go b/src/pkg/backup/details/details_test.go index 33b65db24..2ea7e414c 100644 --- a/src/pkg/backup/details/details_test.go +++ b/src/pkg/backup/details/details_test.go @@ -249,8 +249,8 @@ var pathItemsTable = []struct { }, }, }, - expectRepoRefs: []string{"abcde", "foo.meta"}, - expectLocationRefs: []string{"locationref", "locationref.dirmeta"}, + expectRepoRefs: []string{"abcde"}, + expectLocationRefs: []string{"locationref"}, }, { name: "multiple entries with folder and meta file", @@ -287,8 +287,8 @@ var pathItemsTable = []struct { }, }, }, - expectRepoRefs: []string{"abcde", "12345", "foo.meta"}, - expectLocationRefs: []string{"locationref", "locationref2", "locationref.dirmeta"}, + expectRepoRefs: []string{"abcde", "12345"}, + expectLocationRefs: []string{"locationref", "locationref2"}, }, } @@ -357,7 +357,7 @@ func (suite *DetailsUnitSuite) TestDetailsModel_FilterMetaFiles() { d2 := d.FilterMetaFiles() - assert.Len(t, d2.Entries, 2) + assert.Len(t, d2.Entries, 1) assert.Len(t, d.Entries, 3) } diff --git a/website/docs/support/known-issues.md b/website/docs/support/known-issues.md index 6aabd42e8..3559e0704 100644 --- a/website/docs/support/known-issues.md +++ b/website/docs/support/known-issues.md @@ -19,4 +19,5 @@ Below is a list of known Corso issues and limitations: * Provides no guarantees about whether data moved, added, or deleted in M365 while a backup is being created will be included in the running backup. Future backups run when the data isn't modified will include the data. - \ No newline at end of file + +* OneDrive files ending in `.meta` or `.dirmeta` get omitted from Details and Restore commands.