Trim title before insert/update to database to match the size requirements of database (#32498) (#32507)
This commit is contained in:
parent
f79f8e13e3
commit
781310df77
8 changed files with 18 additions and 0 deletions
|
@ -257,6 +257,7 @@ func GetSearchOrderByBySortType(sortType string) db.SearchOrderBy {
|
|||
}
|
||||
|
||||
// NewProject creates a new Project
|
||||
// The title will be cut off at 255 characters if it's longer than 255 characters.
|
||||
func NewProject(ctx context.Context, p *Project) error {
|
||||
if !IsBoardTypeValid(p.BoardType) {
|
||||
p.BoardType = BoardTypeNone
|
||||
|
@ -276,6 +277,8 @@ func NewProject(ctx context.Context, p *Project) error {
|
|||
}
|
||||
defer committer.Close()
|
||||
|
||||
p.Title, _ = util.SplitStringAtByteN(p.Title, 255)
|
||||
|
||||
if err := db.Insert(ctx, p); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -331,6 +334,7 @@ func UpdateProject(ctx context.Context, p *Project) error {
|
|||
p.CardType = CardTypeTextOnly
|
||||
}
|
||||
|
||||
p.Title, _ = util.SplitStringAtByteN(p.Title, 255)
|
||||
_, err := db.GetEngine(ctx).ID(p.ID).Cols(
|
||||
"title",
|
||||
"description",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue