mirror of
https://github.com/nitezs/sub2sing-box.git
synced 2024-12-23 11:14:41 -05:00
🐛 Fix Error when template name contains "http"
This commit is contained in:
parent
3030ec5259
commit
9575fcf925
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,4 +2,5 @@
|
||||
.vscode/settings.json
|
||||
dist
|
||||
template.json
|
||||
.idea
|
||||
.idea
|
||||
test
|
@ -161,7 +161,11 @@ func AddCountryGroup(proxies []model.Outbound, groupType string, sortKey string,
|
||||
func MergeTemplate(outbounds []model.Outbound, template string) (string, error) {
|
||||
var config model.Config
|
||||
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)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
@ -1,11 +0,0 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"log"
|
||||
"sub2sing-box/model"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCountry(t *testing.T) {
|
||||
log.Println(model.GetContryName("US 节点"))
|
||||
}
|
Loading…
Reference in New Issue
Block a user