fix: fix SensitiveWords error

This commit is contained in:
CaIon
2024-03-21 14:29:56 +08:00
parent d7e25e1604
commit 222a55387d
4 changed files with 23 additions and 13 deletions

View File

@@ -40,7 +40,7 @@ func SensitiveWordReplace(text string, returnImmediately bool) (bool, []string,
for _, hit := range hits {
pos := hit.Pos
word := string(hit.Word)
text = text[:pos] + "*###*" + text[pos+len(word):]
text = text[:pos] + "**###**" + text[pos+len(word):]
words = append(words, word)
}
return true, words, text