diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2024-11-13 23:19:14 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-14 07:19:14 +0000 |
commit | 98d9a71ffe510da0e10d042d8f87a348022aca87 (patch) | |
tree | 992e8ce7a950ac4cef03c435fdd14897312b11f9 /models/actions/run.go | |
parent | b4abb6deff14b741c7666d7579e0eea68443306c (diff) | |
download | gitea-98d9a71ffe510da0e10d042d8f87a348022aca87.tar.gz gitea-98d9a71ffe510da0e10d042d8f87a348022aca87.zip |
Trim title before insert/update to database to match the size requirements of database (#32498)
Fix #32489
Diffstat (limited to 'models/actions/run.go')
-rw-r--r-- | models/actions/run.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/models/actions/run.go b/models/actions/run.go index 37064520a2..732fb48bb9 100644 --- a/models/actions/run.go +++ b/models/actions/run.go @@ -261,6 +261,7 @@ func CancelPreviousJobs(ctx context.Context, repoID int64, ref, workflowID strin } // InsertRun inserts a run +// The title will be cut off at 255 characters if it's longer than 255 characters. func InsertRun(ctx context.Context, run *ActionRun, jobs []*jobparser.SingleWorkflow) error { ctx, committer, err := db.TxContext(ctx) if err != nil { @@ -273,6 +274,7 @@ func InsertRun(ctx context.Context, run *ActionRun, jobs []*jobparser.SingleWork return err } run.Index = index + run.Title, _ = util.SplitStringAtByteN(run.Title, 255) if err := db.Insert(ctx, run); err != nil { return err @@ -399,6 +401,7 @@ func UpdateRun(ctx context.Context, run *ActionRun, cols ...string) error { if len(cols) > 0 { sess.Cols(cols...) } + run.Title, _ = util.SplitStringAtByteN(run.Title, 255) affected, err := sess.Update(run) if err != nil { return err |