@@ -21,6 +21,7 @@ import (
2121	"code.gitea.io/gitea/modules/references" 
2222	api "code.gitea.io/gitea/modules/structs" 
2323	"code.gitea.io/gitea/modules/timeutil" 
24+ 	"code.gitea.io/gitea/modules/util" 
2425
2526	"xorm.io/builder" 
2627)
@@ -138,6 +139,7 @@ func ChangeIssueTitle(ctx context.Context, issue *Issue, doer *user_model.User,
138139	}
139140	defer  committer .Close ()
140141
142+ 	issue .Title , _  =  util .SplitStringAtByteN (issue .Title , 255 )
141143	if  err  =  UpdateIssueCols (ctx , issue , "name" ); err  !=  nil  {
142144		return  fmt .Errorf ("updateIssueCols: %w" , err )
143145	}
@@ -381,6 +383,7 @@ func NewIssueWithIndex(ctx context.Context, doer *user_model.User, opts NewIssue
381383}
382384
383385// NewIssue creates new issue with labels for repository. 
386+ // The title will be cut off at 255 characters if it's longer than 255 characters. 
384387func  NewIssue (ctx  context.Context , repo  * repo_model.Repository , issue  * Issue , labelIDs  []int64 , uuids  []string ) (err  error ) {
385388	ctx , committer , err  :=  db .TxContext (ctx )
386389	if  err  !=  nil  {
@@ -394,6 +397,7 @@ func NewIssue(ctx context.Context, repo *repo_model.Repository, issue *Issue, la
394397	}
395398
396399	issue .Index  =  idx 
400+ 	issue .Title , _  =  util .SplitStringAtByteN (issue .Title , 255 )
397401
398402	if  err  =  NewIssueWithIndex (ctx , issue .Poster , NewIssueOptions {
399403		Repo :        repo ,
0 commit comments