Add limit to Props size in Post table

Этот коммит содержится в:
JoramWilander
2015-12-03 11:57:20 -05:00
родитель 61f90860a8
Коммит cc111205f9
2 изменённых файлов: 5 добавлений и 1 удалений

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

@@ -112,6 +112,10 @@ func (o *Post) IsValid() *AppError {
return NewAppError("Post.IsValid", "Invalid filenames", "id="+o.Id) return NewAppError("Post.IsValid", "Invalid filenames", "id="+o.Id)
} }
if utf8.RuneCountInString(StringInterfaceToJson(o.Props)) > 8000 {
return NewAppError("Post.IsValid", "Invalid props", "id="+o.Id)
}
return nil return nil
} }

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

@@ -30,7 +30,7 @@ func NewSqlPostStore(sqlStore *SqlStore) PostStore {
table.ColMap("Message").SetMaxSize(4000) table.ColMap("Message").SetMaxSize(4000)
table.ColMap("Type").SetMaxSize(26) table.ColMap("Type").SetMaxSize(26)
table.ColMap("Hashtags").SetMaxSize(1000) table.ColMap("Hashtags").SetMaxSize(1000)
table.ColMap("Props") table.ColMap("Props").SetMaxSize(8000)
table.ColMap("Filenames").SetMaxSize(4000) table.ColMap("Filenames").SetMaxSize(4000)
} }