🐛 fix ftp download error

This commit is contained in:
微凉
2022-01-13 22:56:07 +08:00
parent b472c2ee18
commit 424ec10692
3 changed files with 33 additions and 10 deletions

View File

@ -6,7 +6,13 @@ import (
"github.com/jlaffaye/ftp"
)
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
}
conn, err := ftp.Connect(account.SiteUrl)
if err != nil {
return nil, err
@ -20,4 +26,4 @@ func (driver FTP) Login(account *model.Account) (*ftp.ServerConn, error) {
func init() {
base.RegisterDriver(&FTP{})
}
}