From 6f79f53615cc638636edf385244aeb09009e87fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Wed, 17 Mar 2021 15:43:49 +0100 Subject: [PATCH] Fix etag only changing every second --- pkg/storage/fs/owncloud/owncloud_unix.go | 2 +- pkg/storage/fs/owncloud/owncloud_windows.go | 2 +- tests/acceptance/expected-failures-on-OWNCLOUD-storage.md | 4 ---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/pkg/storage/fs/owncloud/owncloud_unix.go b/pkg/storage/fs/owncloud/owncloud_unix.go index 2f058eb276c..52e0088836e 100755 --- a/pkg/storage/fs/owncloud/owncloud_unix.go +++ b/pkg/storage/fs/owncloud/owncloud_unix.go @@ -43,7 +43,7 @@ import ( func calcEtag(ctx context.Context, fi os.FileInfo) string { log := appctx.GetLogger(ctx) h := md5.New() - err := binary.Write(h, binary.BigEndian, fi.ModTime().Unix()) + err := binary.Write(h, binary.BigEndian, fi.ModTime().UnixNano()) if err != nil { log.Error().Err(err).Msg("error writing mtime") } diff --git a/pkg/storage/fs/owncloud/owncloud_windows.go b/pkg/storage/fs/owncloud/owncloud_windows.go index 1ad8d3f2dfc..29b93dc72c6 100644 --- a/pkg/storage/fs/owncloud/owncloud_windows.go +++ b/pkg/storage/fs/owncloud/owncloud_windows.go @@ -40,7 +40,7 @@ import ( func calcEtag(ctx context.Context, fi os.FileInfo) string { log := appctx.GetLogger(ctx) h := md5.New() - err := binary.Write(h, binary.BigEndian, fi.ModTime().Unix()) + err := binary.Write(h, binary.BigEndian, fi.ModTime().UnixNano()) if err != nil { log.Error().Err(err).Msg("error writing mtime") } diff --git a/tests/acceptance/expected-failures-on-OWNCLOUD-storage.md b/tests/acceptance/expected-failures-on-OWNCLOUD-storage.md index 27d82610da0..1bc03a7e6bd 100644 --- a/tests/acceptance/expected-failures-on-OWNCLOUD-storage.md +++ b/tests/acceptance/expected-failures-on-OWNCLOUD-storage.md @@ -46,10 +46,6 @@ The following scenarios fail on OWNCLOUD storage but not on OCIS storage: - [apiTrashbin/trashbinRestore.feature:52](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinRestore.feature#L52) - [apiTrashbin/trashbinRestore.feature:69](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinRestore.feature#L69) - [apiTrashbin/trashbinRestore.feature:70](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinRestore.feature#L70) -- [apiTrashbin/trashbinRestore.feature:117](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinRestore.feature#L117) -- [apiTrashbin/trashbinRestore.feature:118](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinRestore.feature#L118) -- [apiTrashbin/trashbinRestore.feature:119](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinRestore.feature#L119) -- [apiTrashbin/trashbinRestore.feature:120](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinRestore.feature#L120) - [apiTrashbin/trashbinRestore.feature:213](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinRestore.feature#L213) - [apiTrashbin/trashbinRestore.feature:214](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinRestore.feature#L214) - [apiTrashbin/trashbinRestore.feature:258](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinRestore.feature#L258)