Fixed string length checks for fields that can contain unicode characters

Этот коммит содержится в:
hmhealey
2015-11-05 09:25:59 -05:00
родитель 2c2775e221
Коммит c016a88c84
6 изменённых файлов: 18 добавлений и 12 удалений

Просмотреть файл

@@ -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)
}