From cb23edc1fe18b1e8b37ea1d5eb4a93f6a256e1b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=AE=E5=87=89?= Date: Mon, 31 Jan 2022 11:13:29 +0800 Subject: [PATCH] :bug: fix #462 check connect while get ftp client --- drivers/ftp/ftp.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/ftp/ftp.go b/drivers/ftp/ftp.go index f41f99a9..e3f7353b 100644 --- a/drivers/ftp/ftp.go +++ b/drivers/ftp/ftp.go @@ -11,7 +11,12 @@ var connMap map[string]*ftp.ServerConn func (driver FTP) Login(account *model.Account) (*ftp.ServerConn, error) { conn, ok := connMap[account.Name] if ok { - return conn, nil + _, err := conn.CurrentDir() + if err == nil { + return conn, nil + } else { + delete(connMap, account.Name) + } } conn, err := ftp.Connect(account.SiteUrl) if err != nil {