Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

webdav: Fix modtime on server side copy for owncloud and nextcloud

Nick Craig-Wood73beae147f4d
diff --git a/backend/webdav/webdav.go b/backend/webdav/webdav.go
index 206b11bd1..397cd0b92 100644
--- a/backend/webdav/webdav.go
+++ b/backend/webdav/webdav.go
@@ -1068,6 +1068,13 @@ func (f *Fs) copyOrMove(ctx context.Context, src fs.Object, remote string, metho
if err != nil {
return nil, fmt.Errorf("copy NewObject failed: %w", err)
}
+ if f.useOCMtime && resp.Header.Get("X-OC-Mtime") != "accepted" && f.propsetMtime {
+ fs.Debugf(dstObj, "Setting modtime after copy to %v", src.ModTime(ctx))
+ err = dstObj.SetModTime(ctx, src.ModTime(ctx))
+ if err != nil {
+ return nil, fmt.Errorf("failed to set modtime: %w", err)
+ }
+ }
return dstObj, nil
}
diff --git a/fstest/test_all/config.yaml b/fstest/test_all/config.yaml
index 413ed60d1..89a2bd46b 100644
--- a/fstest/test_all/config.yaml
+++ b/fstest/test_all/config.yaml
@@ -333,10 +333,6 @@ backends:
ignore:
- TestIntegration/FsMkdir/FsEncoding/punctuation
- TestIntegration/FsMkdir/FsEncoding/invalid_UTF-8
- - TestIntegration/FsMkdir/FsPutFiles/FsCopy
- - TestCopyFileCopyDest
- - TestServerSideCopy
- - TestSyncCopyDest
fastlist: false
- backend: "webdav"
remote: "TestWebdavRclone:"