sftpfs: improve remove

we know if the client asks to remove a file or directory so let's
use the appropriate command without letting the sftp library guess
the appropriate behavior

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino 2022-02-16 16:46:28 +01:00
parent 900e519ff1
commit 876bf8aa4f
No known key found for this signature in database
GPG key ID: 2F1FB59433D5A8CB

View file

@ -335,6 +335,9 @@ func (fs *SFTPFs) Remove(name string, isDir bool) error {
if err := fs.checkConnection(); err != nil {
return err
}
if isDir {
return fs.sftpClient.RemoveDirectory(name)
}
return fs.sftpClient.Remove(name)
}