-
Notifications
You must be signed in to change notification settings - Fork 166
Open
Description
len(string) does not count by characters but by bytes, so if a multibyte string is specified for validation, it cannot be validated by characters.
In order to accurately determine the number of characters, len([]rune(string)) should be used.
go-proto-validators/plugin/plugin.go
Line 446 in 32a686a
| p.P(`if !( len(`, variableName, `) < `, fv.LengthLt, `) {`) |
v0.3.2 generated
if !(len(this.Keyword) < 1000) {
I think this is a good way to fix it.
if !(len([]rune(this.Keyword)) < 1000) {
Metadata
Metadata
Assignees
Labels
No labels