From 323dad2a1c4fc9c90b052f5615d5120bf5801bd6 Mon Sep 17 00:00:00 2001 From: Noah Hsu Date: Sat, 28 May 2022 21:01:04 +0800 Subject: [PATCH] fix(sftp): infinite loop while remove file (close #1094) --- drivers/sftp/driver.go | 2 +- drivers/sftp/sftp.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/sftp/driver.go b/drivers/sftp/driver.go index a0b70b1b4fc..a531e826004 100644 --- a/drivers/sftp/driver.go +++ b/drivers/sftp/driver.go @@ -195,7 +195,7 @@ func (driver SFTP) Delete(path string, account *model.Account) error { if err != nil { return err } - return client.Remove(utils.Join(account.RootFolder, path)) + return client.remove(utils.Join(account.RootFolder, path)) } func (driver SFTP) Upload(file *model.FileStream, account *model.Account) error { diff --git a/drivers/sftp/sftp.go b/drivers/sftp/sftp.go index 8115dbd13a9..c314f55b41e 100644 --- a/drivers/sftp/sftp.go +++ b/drivers/sftp/sftp.go @@ -49,7 +49,7 @@ func (client *Client) Files(remotePath string) ([]os.FileInfo, error) { return client.ReadDir(remotePath) } -func (client *Client) Remove(remotePath string) error { +func (client *Client) remove(remotePath string) error { f, err := client.Stat(remotePath) if err != nil { return nil