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: fix initialization bug introduced by fs.ErrorIsDir return

Nick Craig-Wood96e14bf4564c
diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.go
index af2d0abbe..7b6e2ae3b 100644
--- a/backend/sftp/sftp.go
+++ b/backend/sftp/sftp.go
@@ -784,7 +784,7 @@ func NewFsWithConnection(ctx context.Context, f *Fs, name string, root string, m
}
_, err := f.NewObject(ctx, remote)
if err != nil {
- if err == fs.ErrorObjectNotFound || errors.Cause(err) == fs.ErrorNotAFile {
+ if err == fs.ErrorObjectNotFound || err == fs.ErrorIsDir {
// File doesn't exist so return old f
f.root = root
f.absRoot = oldAbsRoot