"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
sftp: fix issue with WS_FTP by working around failing RealPath
albertonyf0396070ebc2
diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.goindex bb5add94d..6a4259542 100644--- a/backend/sftp/sftp.go+++ b/backend/sftp/sftp.go@@ -935,11 +935,22 @@ func NewFsWithConnection(ctx context.Context, f *Fs, name string, root string, m// It appears that WS FTP doesn't like relative paths,// and the openssh sftp tool also uses absolute paths.if !path.IsAbs(f.root) {- path, err := c.sftpClient.RealPath(f.root)+ // Trying RealPath first, to perform proper server-side canonicalize.+ // It may fail (SSH_FX_FAILURE reported on WS FTP) and will then resort+ // to simple path join with current directory from Getwd (which can work+ // on WS FTP, even though it is also based on RealPath).+ absRoot, err := c.sftpClient.RealPath(f.root)if err != nil {- fs.Debugf(f, "Failed to resolve path - using relative paths: %v", err)+ fs.Debugf(f, "Failed to resolve path using RealPath: %v", err)+ cwd, err := c.sftpClient.Getwd()+ if err != nil {+ fs.Debugf(f, "Failed to to read current directory - using relative paths: %v", err)+ } else {+ f.absRoot = path.Join(cwd, f.root)+ fs.Debugf(f, "Relative path joined with current directory to get absolute path %q", f.absRoot)+ }} else {- f.absRoot = path+ f.absRoot = absRootfs.Debugf(f, "Relative path resolved to %q", f.absRoot)}}