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: don't error on dangling symlinks

Nick Craig-Woodbe643ecfbc81
diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.go
index 1c4b75767..72f103fa1 100644
--- a/backend/sftp/sftp.go
+++ b/backend/sftp/sftp.go
@@ -565,9 +565,13 @@ func (f *Fs) List(dir string) (entries fs.DirEntries, err error) {
// If file is a symlink (not a regular file is the best cross platform test we can do), do a stat to
// pick up the size and type of the destination, instead of the size and type of the symlink.
if !info.Mode().IsRegular() {
+ oldInfo := info
info, err = f.stat(remote)
if err != nil {
- return nil, errors.Wrap(err, "stat of non-regular file/dir failed")
+ if !os.IsNotExist(err) {
+ fs.Errorf(remote, "stat of non-regular file/dir failed: %v", err)
+ }
+ info = oldInfo
}
}
if info.IsDir() {