fix: 忽略 WebDAV 获取端口信息错误日志 (#3946)

This commit is contained in:
ssongliu 2024-02-22 13:42:06 +08:00 committed by GitHub
parent ef5e42cf0b
commit 63484601b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -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 ""

View File

@ -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)