1
0
mirror of https://github.com/nitezs/sub2sing-box.git synced 2024-12-23 21:44:41 -05:00

🐛 Fix Error when template name contains "http"

This commit is contained in:
Nite07 2024-05-09 14:12:55 +08:00
parent 3030ec5259
commit 9575fcf925
3 changed files with 7 additions and 13 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
dist dist
template.json template.json
.idea .idea
test

View File

@ -161,7 +161,11 @@ func AddCountryGroup(proxies []model.Outbound, groupType string, sortKey string,
func MergeTemplate(outbounds []model.Outbound, template string) (string, error) { func MergeTemplate(outbounds []model.Outbound, template string) (string, error) {
var config model.Config var config model.Config
var err error var err error
if strings.HasPrefix(template, "http") { isNetworkFile, err := regexp.MatchString(`^https?://`, template)
if err != nil {
return "", err
}
if isNetworkFile {
data, err := util.Fetch(template, 3) data, err := util.Fetch(template, 3)
if err != nil { if err != nil {
return "", err return "", err

View File

@ -1,11 +0,0 @@
package model
import (
"log"
"sub2sing-box/model"
"testing"
)
func TestCountry(t *testing.T) {
log.Println(model.GetContryName("US 节点"))
}