sftp: fix initialization bug introduced by fs.ErrorIsDir return

3fbaa4c0b0 backends: make NewObject return fs.ErrorIsDir if possible
This commit is contained in:
Nick Craig-Wood 2021-10-16 10:32:29 +01:00
parent 54da6154c4
commit 96e14bf456
1 changed files with 1 additions and 1 deletions

View File

@ -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