mirror of
https://github.com/simon-ding/polaris.git
synced 2026-05-08 03:27:27 +08:00
feat: ascii name should match words
This commit is contained in:
@@ -27,6 +27,11 @@ func (m *Metadata) IsAcceptable(names... string) bool {
|
||||
name = strings.Join(strings.Fields(name), " ")
|
||||
nameCN = strings.Join(strings.Fields(nameCN), " ")
|
||||
nameEN = strings.Join(strings.Fields(nameEN), " ")
|
||||
if utils.IsASCII(name) { //ascii name should match words
|
||||
re := regexp.MustCompile(`\b` + name + `\b`)
|
||||
return re.MatchString(nameCN) || re.MatchString(nameEN)
|
||||
}
|
||||
|
||||
if strings.Contains(nameCN, name) || strings.Contains(nameEN, name) {
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user