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

sftp: Completely ignore all modtime checks if SetModTime=false

Jon Fautleycd762f04b89d
diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.go
index 54e45c295..d7b921f26 100644
--- a/backend/sftp/sftp.go
+++ b/backend/sftp/sftp.go
@@ -1022,16 +1022,17 @@ func (o *Object) stat() error {
//
// it also updates the info field
func (o *Object) SetModTime(ctx context.Context, modTime time.Time) error {
+ if !o.fs.opt.SetModTime {
+ return nil
+ }
c, err := o.fs.getSftpConnection()
if err != nil {
return errors.Wrap(err, "SetModTime")
}
- if o.fs.opt.SetModTime {
- err = c.sftpClient.Chtimes(o.path(), modTime, modTime)
- o.fs.putSftpConnection(&c, err)
- if err != nil {
- return errors.Wrap(err, "SetModTime failed")
- }
+ err = c.sftpClient.Chtimes(o.path(), modTime, modTime)
+ o.fs.putSftpConnection(&c, err)
+ if err != nil {
+ return errors.Wrap(err, "SetModTime failed")
}
err = o.stat()
if err != nil {