"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
operations: Fix "optional feature not implemented" error with a crypted sftp
Nick Craig-Woodff855fe1fbde
diff --git a/fs/operations/operations.go b/fs/operations/operations.goindex 13c3794b3..c9a331702 100644--- a/fs/operations/operations.go+++ b/fs/operations/operations.go@@ -2628,11 +2628,15 @@ func SetDirModTime(ctx context.Context, f fs.Fs, dst fs.Directory, dir string, mif dst != nil {if do, ok := dst.(fs.SetModTimer); ok {err := do.SetModTime(ctx, modTime)- if err != nil {+ if errors.Is(err, fs.ErrorNotImplemented) {+ // Fall through and run the code below if not implemented+ // This can happen for fs.DirWrapper instances+ } else if err != nil {return dst, err+ } else {+ fs.Infof(logName, "Set directory modification time (using SetModTime)")+ return dst, nil}- fs.Infof(logName, "Set directory modification time (using SetModTime)")- return dst, nil}}diff --git a/fs/operations/operations_test.go b/fs/operations/operations_test.goindex 9bba6ffff..d14678f13 100644--- a/fs/operations/operations_test.go+++ b/fs/operations/operations_test.go@@ -1787,6 +1787,13 @@ func TestSetDirModTime(t *testing.T) {fstest.CheckDirModTime(ctx, t, r.Fremote, newDst, t2)}fstest.CheckDirModTime(ctx, t, r.Fremote, fstest.NewDirectory(ctx, t, r.Fremote, name), t2)++ // Now wrap the directory to make the SetModTime method return fs.ErrorNotImplemented and check that it falls back correctly+ wrappedDir := fs.NewDirWrapper(existingDir.Remote(), fs.NewDir(existingDir.Remote(), existingDir.ModTime(ctx)))+ newDst, err = operations.SetDirModTime(ctx, r.Fremote, wrappedDir, "SHOULD BE IGNORED", t1)+ require.NoError(t, err)+ require.NotNil(t, newDst)+ fstest.CheckDirModTime(ctx, t, r.Fremote, fstest.NewDirectory(ctx, t, r.Fremote, name), t1)}func TestDirsEqual(t *testing.T) {