Browse Source

feat:新增

wangchuanjin 3 years ago
parent
commit
2a57d1ee06
1 changed files with 2 additions and 2 deletions
  1. 2 2
      fsw/filter.go

+ 2 - 2
fsw/filter.go

@@ -5,7 +5,7 @@ import (
 )
 
 const (
-	REPLTXT = "*************************************"
+	REPLTXT = "**************************************************************************"
 )
 
 //过滤,验证是否存在敏感词
@@ -76,7 +76,7 @@ func Repl(atxt ...string) string {
 	}
 	for _, keyword := range keywords {
 		if len(atxt) == 1 {
-			txt = strings.Replace(txt, keyword, REPLTXT[:len(keyword)], -1)
+			txt = strings.Replace(txt, keyword, REPLTXT[:len([]rune(keyword))], -1)
 		} else {
 			txt = strings.Replace(txt, keyword, repl, -1)
 		}