fix: 在 fetchSelf 函数中初始化 reply 变量以确保返回值的正确性

This commit is contained in:
lixiangwuxian 2025-04-11 00:51:01 +08:00
parent 893c4ae887
commit 98c9073f0d
2 changed files with 2 additions and 5 deletions

View File

@ -95,6 +95,7 @@ func fetchSelf(msg model.Message) (reply *model.Reply) {
log.Println("parseSystemInfo failed", err) log.Println("parseSystemInfo failed", err)
return return
} }
reply = &model.Reply{}
reply.FromMsg = msg reply.FromMsg = msg
reply.ReplyMsg = info.String() reply.ReplyMsg = info.String()
return return

View File

@ -2,7 +2,6 @@ package util
import ( import (
"bytes" "bytes"
"crypto/tls"
"fmt" "fmt"
"io" "io"
"net/url" "net/url"
@ -72,10 +71,7 @@ func DownloadFile(urlStr string, dirPath string) (filepath string, err error) {
ReadTimeout: 30 * time.Second, ReadTimeout: 30 * time.Second,
WriteTimeout: 30 * time.Second, WriteTimeout: 30 * time.Second,
MaxConnWaitTimeout: 30 * time.Second, MaxConnWaitTimeout: 30 * time.Second,
// TLSConfig: nil, // 使用默认配置 TLSConfig: nil,
TLSConfig: &tls.Config{
InsecureSkipVerify: true,
},
} }
// 准备请求 // 准备请求