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:
parent
03ab73d92e
commit
c2e8790df3
8 changed files with 18 additions and 0 deletions
|
@ -271,6 +271,7 @@ func GetRunnerByID(ctx context.Context, id int64) (*ActionRunner, error) {
|
|||
// UpdateRunner updates runner's information.
|
||||
func UpdateRunner(ctx context.Context, r *ActionRunner, cols ...string) error {
|
||||
e := db.GetEngine(ctx)
|
||||
r.Name, _ = util.SplitStringAtByteN(r.Name, 255)
|
||||
var err error
|
||||
if len(cols) == 0 {
|
||||
_, err = e.ID(r.ID).AllCols().Update(r)
|
||||
|
@ -312,6 +313,7 @@ func CreateRunner(ctx context.Context, t *ActionRunner) error {
|
|||
// Remove OwnerID to avoid confusion; it's not worth returning an error here.
|
||||
t.OwnerID = 0
|
||||
}
|
||||
t.Name, _ = util.SplitStringAtByteN(t.Name, 255)
|
||||
return db.Insert(ctx, t)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue