Trim title before insert/update to database to match the size requirements of database (#32498)

Fix #32489

(cherry picked from commit 98d9a71ffe510da0e10d042d8f87a348022aca87)
This commit is contained in:
Lunny Xiao 2024-11-13 23:19:14 -08:00 committed by Earl Warren
parent 03ab73d92e
commit c2e8790df3
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
8 changed files with 18 additions and 0 deletions

View file

@ -12,6 +12,7 @@ import (
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/timeutil"
"code.gitea.io/gitea/modules/util"
webhook_module "code.gitea.io/gitea/modules/webhook"
)
@ -67,6 +68,7 @@ func CreateScheduleTask(ctx context.Context, rows []*ActionSchedule) error {
// Loop through each schedule row
for _, row := range rows {
row.Title, _ = util.SplitStringAtByteN(row.Title, 255)
// Create new schedule row
if err = db.Insert(ctx, row); err != nil {
return err