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 удалений

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

@@ -7,6 +7,7 @@ import (
"encoding/json"
"fmt"
"io"
"unicode/utf8"
)
type OAuthApp struct {
@@ -57,7 +58,7 @@ func (a *OAuthApp) IsValid() *AppError {
return NewAppError("OAuthApp.IsValid", "Invalid homepage", "app_id="+a.Id)
}
if len(a.Description) > 512 {
if utf8.RuneCountInString(a.Description) > 512 {
return NewAppError("OAuthApp.IsValid", "Invalid description", "app_id="+a.Id)
}