From c016a88c845ecaa4d219de43243efe07f0103c2d Mon Sep 17 00:00:00 2001 From: hmhealey Date: Thu, 5 Nov 2015 09:25:59 -0500 Subject: Fixed string length checks for fields that can contain unicode characters --- model/team.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'model/team.go') diff --git a/model/team.go b/model/team.go index 5c9cf5a26..e7dde4766 100644 --- a/model/team.go +++ b/model/team.go @@ -9,6 +9,7 @@ import ( "io" "regexp" "strings" + "unicode/utf8" ) const ( @@ -122,7 +123,7 @@ func (o *Team) IsValid(restrictTeamNames bool) *AppError { return NewAppError("Team.IsValid", "Invalid email", "id="+o.Id) } - if len(o.DisplayName) == 0 || len(o.DisplayName) > 64 { + if utf8.RuneCountInString(o.DisplayName) == 0 || utf8.RuneCountInString(o.DisplayName) > 64 { return NewAppError("Team.IsValid", "Invalid name", "id="+o.Id) } -- cgit v1.2.3-1-g7c22