Index out of range error when censoring cyrillic language #25
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Describe the bug
When i try to censor a word in cyrillic it throw a panic error
What do you see?
What do you expect to see?
A correct censorship of the word
List the steps that must be taken to reproduce this issue
Version
1.6.0
Additional information
No response
I think the problem is that there are 7 characters, but the
len("крывавы")probably returns 14, so character replacement might fail around there:TwiN/go-away@bd63346fc7/goaway.go (L178-L180)I think I have a fix for that. It is true that instead of checkinglen(word)we should checklen([]rune(word))but also when doingrememberOriginalIndexeswe should iterate[]runeinstead ofstring. I'll create PR shortly, as I can reproduce the issue even without cyrilic characters simply by using“in the string before the profanity occurencenope, it's not going to be that easy..