mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 09:32:29 +08:00
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
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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:"
|
||||
|
|
Loading…
Reference in New Issue
Block a user