From 63484601b583c98aebe263139dbbe347731c80f0 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Thu, 22 Feb 2024 13:42:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BF=BD=E7=95=A5=20WebDAV=20=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=AB=AF=E5=8F=A3=E4=BF=A1=E6=81=AF=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=97=A5=E5=BF=97=20(#3946)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/utils/cloud_storage/client/helper.go | 2 +- backend/utils/cloud_storage/client/sftp.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/utils/cloud_storage/client/helper.go b/backend/utils/cloud_storage/client/helper.go index 31575d4b1..37ebdb359 100644 --- a/backend/utils/cloud_storage/client/helper.go +++ b/backend/utils/cloud_storage/client/helper.go @@ -8,7 +8,7 @@ import ( func loadParamFromVars(key string, vars map[string]interface{}) string { if _, ok := vars[key]; !ok { - if key != "bucket" { + if key != "bucket" && key != "port" { global.LOG.Errorf("load param %s from vars failed, err: not exist!", key) } return "" diff --git a/backend/utils/cloud_storage/client/sftp.go b/backend/utils/cloud_storage/client/sftp.go index 749e796c8..b48b10cde 100644 --- a/backend/utils/cloud_storage/client/sftp.go +++ b/backend/utils/cloud_storage/client/sftp.go @@ -8,6 +8,7 @@ import ( "path" "time" + "github.com/1Panel-dev/1Panel/backend/global" "github.com/pkg/sftp" "golang.org/x/crypto/ssh" ) @@ -21,6 +22,9 @@ type sftpClient struct { func NewSftpClient(vars map[string]interface{}) (*sftpClient, error) { address := loadParamFromVars("address", vars) port := loadParamFromVars("port", vars) + if len(port) == 0 { + global.LOG.Errorf("load param port from vars failed, err: not exist!") + } password := loadParamFromVars("password", vars) username := loadParamFromVars("username", vars) bucket := loadParamFromVars("bucket", vars)