fix(ftp): remove dir (#1082)
This commit is contained in:
parent
79c9b6ac77
commit
87e339850d
@ -227,13 +227,21 @@ func (driver FTP) Copy(src string, dst string, account *model.Account) error {
|
|||||||
|
|
||||||
func (driver FTP) Delete(path string, account *model.Account) error {
|
func (driver FTP) Delete(path string, account *model.Account) error {
|
||||||
path = utils.ParsePath(path)
|
path = utils.ParsePath(path)
|
||||||
|
file, err := driver.File(path, account)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
realPath := utils.Join(account.RootFolder, path)
|
realPath := utils.Join(account.RootFolder, path)
|
||||||
conn, err := driver.Login(account)
|
conn, err := driver.Login(account)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
//defer func() { _ = conn.Quit() }()
|
//defer func() { _ = conn.Quit() }()
|
||||||
err = conn.Delete(realPath)
|
if file.IsDir() {
|
||||||
|
err = conn.RemoveDirRecur(realPath)
|
||||||
|
} else {
|
||||||
|
err = conn.Delete(realPath)
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user