mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Fixed string length checks for fields that can contain unicode characters
This commit is contained in:
@@ -6,6 +6,7 @@ package model
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -52,7 +53,7 @@ func (o *Preference) IsValid() *AppError {
|
||||
return NewAppError("Preference.IsValid", "Invalid name", "name="+o.Name)
|
||||
}
|
||||
|
||||
if len(o.Value) > 128 {
|
||||
if utf8.RuneCountInString(o.Value) > 128 {
|
||||
return NewAppError("Preference.IsValid", "Value is too long", "value="+o.Value)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user