fix: 修复无法加载本地模板的问题

This commit is contained in:
2024-02-15 15:35:07 +08:00
parent 73e94ad856
commit 3616ae870a
2 changed files with 11 additions and 9 deletions

View File

@ -5,7 +5,6 @@ import (
"encoding/hex"
"errors"
"net/url"
"os"
"regexp"
"strings"
@ -73,13 +72,13 @@ func ParseQuery(c *gin.Context) (SubValidator, error) {
query.Proxies = nil
}
if query.Template != "" {
uri, err := url.ParseRequestURI(query.Template)
if err != nil {
if strings.Contains(query.Template, string(os.PathSeparator)) {
if strings.HasPrefix(query.Template, "http") {
uri, err := url.ParseRequestURI(query.Template)
if err != nil {
return SubValidator{}, err
}
query.Template = uri.String()
}
query.Template = uri.String()
}
if query.RuleProvider != "" {
reg := regexp.MustCompile(`\[(.*?)\]`)