mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-05 09:30:24 +08:00
修复只有一个泛域名时无法查询匹配证书的问题
This commit is contained in:
@@ -684,7 +684,7 @@ func (this *SSLCertDAO) buildDomainSearchingQuery(query *dbs.Query, domains []st
|
|||||||
for _, domain := range domains {
|
for _, domain := range domains {
|
||||||
domainMap[domain] = true
|
domainMap[domain] = true
|
||||||
}
|
}
|
||||||
var reg = regexp.MustCompile(`^[\w.-]+$`) // 为了下面的SQL语句安全先不支持其他字符
|
var reg = regexp.MustCompile(`^[\w*.-]+$`) // 为了下面的SQL语句安全先不支持其他字符
|
||||||
for domain := range domainMap {
|
for domain := range domainMap {
|
||||||
if !reg.MatchString(domain) {
|
if !reg.MatchString(domain) {
|
||||||
continue
|
continue
|
||||||
@@ -729,7 +729,9 @@ func (this *SSLCertDAO) buildDomainSearchingQuery(query *dbs.Query, domains []st
|
|||||||
|
|
||||||
sqlPieces = append(sqlPieces, "JSON_CONTAINS(dnsNames, '"+string(domainJSON)+"')")
|
sqlPieces = append(sqlPieces, "JSON_CONTAINS(dnsNames, '"+string(domainJSON)+"')")
|
||||||
}
|
}
|
||||||
|
if len(sqlPieces) > 0 {
|
||||||
query.Where("(" + strings.Join(sqlPieces, " OR ") + ")")
|
query.Where("(" + strings.Join(sqlPieces, " OR ") + ")")
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user