forked from TrueCloudLab/rclone
webdav: Fix modtime on server side copy for owncloud and nextcloud
Before this change a server side copy did not preserve the modtime. This used to work on nextcloud but at some point it started ignoring the `X-Oc-Mtime` header. This patch sets the modtime explicitly after a server side copy if the `X-Oc-Mtime` wasn't accepted. This problem was discovered in the integration tests.
This commit is contained in:
parent
92f8e476b7
commit
73beae147f
2 changed files with 7 additions and 4 deletions
|
@ -1068,6 +1068,13 @@ func (f *Fs) copyOrMove(ctx context.Context, src fs.Object, remote string, metho
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("copy NewObject failed: %w", err)
|
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
|
return dstObj, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -333,10 +333,6 @@ backends:
|
||||||
ignore:
|
ignore:
|
||||||
- TestIntegration/FsMkdir/FsEncoding/punctuation
|
- TestIntegration/FsMkdir/FsEncoding/punctuation
|
||||||
- TestIntegration/FsMkdir/FsEncoding/invalid_UTF-8
|
- TestIntegration/FsMkdir/FsEncoding/invalid_UTF-8
|
||||||
- TestIntegration/FsMkdir/FsPutFiles/FsCopy
|
|
||||||
- TestCopyFileCopyDest
|
|
||||||
- TestServerSideCopy
|
|
||||||
- TestSyncCopyDest
|
|
||||||
fastlist: false
|
fastlist: false
|
||||||
- backend: "webdav"
|
- backend: "webdav"
|
||||||
remote: "TestWebdavRclone:"
|
remote: "TestWebdavRclone:"
|
||||||
|
|
Loading…
Add table
Reference in a new issue