From ecfea63eddeb24107f0d90287431156adceb1f66 Mon Sep 17 00:00:00 2001 From: nyne Date: Tue, 2 Dec 2025 21:57:50 +0800 Subject: [PATCH] fix: enable explicit TLS for FTP connections in Upload and Delete methods --- server/storage/ftp.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/storage/ftp.go b/server/storage/ftp.go index 20d2a1e..92c5608 100644 --- a/server/storage/ftp.go +++ b/server/storage/ftp.go @@ -22,7 +22,7 @@ type FTPStorage struct { func (f *FTPStorage) Upload(filePath string, fileName string) (string, error) { // 连接到FTP服务器 - conn, err := ftp.Dial(f.Host, ftp.DialWithTimeout(10*time.Second)) + conn, err := ftp.Dial(f.Host, ftp.DialWithTimeout(10*time.Second), ftp.DialWithExplicitTLS(nil)) if err != nil { log.Error("Failed to connect to FTP server: ", err) return "", errors.New("failed to connect to FTP server") @@ -76,7 +76,7 @@ func (f *FTPStorage) Download(storageKey string, fileName string) (string, error func (f *FTPStorage) Delete(storageKey string) error { // 连接到FTP服务器 - conn, err := ftp.Dial(f.Host, ftp.DialWithTimeout(10*time.Second)) + conn, err := ftp.Dial(f.Host, ftp.DialWithTimeout(10*time.Second), ftp.DialWithExplicitTLS(nil)) if err != nil { log.Error("Failed to connect to FTP server: ", err) return errors.New("failed to connect to FTP server")