From f2e857ff052ddd23bb2476eb138338138963f6c3 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Wed, 6 Nov 2024 16:07:42 +0100 Subject: [PATCH] fix: 'ocis backup consistency' file regex 'ocis backup consistency' was stumbling over revision (and trash) nodes whose timestamp lacked the nanosecond component (which happens if the nanoseconds of the mtime are 0) Fixes: #9498 --- changelog/unreleased/fix-backup-consistency-cmd.md | 8 ++++++++ ocis/pkg/backup/backup.go | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 changelog/unreleased/fix-backup-consistency-cmd.md diff --git a/changelog/unreleased/fix-backup-consistency-cmd.md b/changelog/unreleased/fix-backup-consistency-cmd.md new file mode 100644 index 000000000..9328fba6b --- /dev/null +++ b/changelog/unreleased/fix-backup-consistency-cmd.md @@ -0,0 +1,8 @@ +Bugfix: 'ocis backup consistency' fixed for file revisions + +A bug was fixed that caused the 'ocis backup consistency' command to incorrectly report +inconistencies when file revisions with a zero value for the nano-second part of the +timestamp were present. + +https://github.com/owncloud/ocis/pull/10493 +https://github.com/owncloud/ocis/issues/9498 diff --git a/ocis/pkg/backup/backup.go b/ocis/pkg/backup/backup.go index ea1fd02e4..3c7e93a83 100644 --- a/ocis/pkg/backup/backup.go +++ b/ocis/pkg/backup/backup.go @@ -28,9 +28,9 @@ var ( // regex to determine if a node is trashed or versioned. // 9113a718-8285-4b32-9042-f930f1a58ac2.REV.2024-05-22T07:32:53.89969726Z - _versionRegex = regexp.MustCompile(`\.REV\.[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+Z$`) + _versionRegex = regexp.MustCompile(`\.REV\.[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?Z$`) // 9113a718-8285-4b32-9042-f930f1a58ac2.T.2024-05-23T08:25:20.006571811Z <- this HAS a symlink - _trashRegex = regexp.MustCompile(`\.T\.[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+Z$`) + _trashRegex = regexp.MustCompile(`\.T\.[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?Z$`) ) // Consistency holds the node and blob data of a storage provider