1
mirror of https://github.com/rclone/rclone synced 2024-12-23 14:23:44 +01:00

sftp: don't check remote points to a file if it ends with /

This avoids calling stat on the root directory which saves a call and
some servers don't like.

See: https://forum.rclone.org/t/stat-failed-error-on-sftp/38045
This commit is contained in:
Nick Craig-Wood 2023-05-10 15:06:13 +01:00
parent e6e6069ecf
commit 2cd85813b4

View File

@ -1066,7 +1066,7 @@ func NewFsWithConnection(ctx context.Context, f *Fs, name string, root string, m
}
}
f.putSftpConnection(&c, err)
if root != "" {
if root != "" && !strings.HasSuffix(root, "/") {
// Check to see if the root is actually an existing file,
// and if so change the filesystem root to its parent directory.
oldAbsRoot := f.absRoot