mxs 1 год назад
Родитель
Сommit
9824112499
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      download_file/src/task.go

+ 3 - 1
download_file/src/task.go

@@ -198,6 +198,7 @@ func FilterAndDownload(hrefMap map[string]string) (result []*Data) {
 				FileType: strings.ReplaceAll(fileType, ".", ""),
 			})
 		} else {
+			continue
 			//textStr = reg_fileter_text.ReplaceAllString(textStr, "")  //过滤无效字符
 			if reg_invalid_text.ReplaceAllString(tmpText, "") == "" { //无效,全文本匹配,舍弃
 				continue
@@ -344,7 +345,7 @@ func DealAndDownload(tmp []*Data, href string) (result []*Data, attachments, att
 	return
 }
 
-//下载
+// 下载
 func Download(url string) (string, []byte) {
 	defer qu.Catch()
 	client := &http.Client{
@@ -353,6 +354,7 @@ func Download(url string) (string, []byte) {
 			TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
 		},
 	}
+	defer client.CloseIdleConnections()
 	req, err := http.NewRequest("GET", url, nil)
 	if err != nil {
 		//fmt.Println("Error creating request:", err)