@@ -21,6 +21,7 @@ import (
21
21
"code.gitea.io/gitea/modules/references"
22
22
api "code.gitea.io/gitea/modules/structs"
23
23
"code.gitea.io/gitea/modules/timeutil"
24
+ "code.gitea.io/gitea/modules/util"
24
25
25
26
"xorm.io/builder"
26
27
)
@@ -138,6 +139,7 @@ func ChangeIssueTitle(ctx context.Context, issue *Issue, doer *user_model.User,
138
139
}
139
140
defer committer .Close ()
140
141
142
+ issue .Title , _ = util .SplitStringAtByteN (issue .Title , 255 )
141
143
if err = UpdateIssueCols (ctx , issue , "name" ); err != nil {
142
144
return fmt .Errorf ("updateIssueCols: %w" , err )
143
145
}
@@ -386,6 +388,7 @@ func NewIssueWithIndex(ctx context.Context, doer *user_model.User, opts NewIssue
386
388
}
387
389
388
390
// NewIssue creates new issue with labels for repository.
391
+ // The title will be cut off at 255 characters if it's longer than 255 characters.
389
392
func NewIssue (ctx context.Context , repo * repo_model.Repository , issue * Issue , labelIDs []int64 , uuids []string ) (err error ) {
390
393
ctx , committer , err := db .TxContext (ctx )
391
394
if err != nil {
@@ -399,6 +402,7 @@ func NewIssue(ctx context.Context, repo *repo_model.Repository, issue *Issue, la
399
402
}
400
403
401
404
issue .Index = idx
405
+ issue .Title , _ = util .SplitStringAtByteN (issue .Title , 255 )
402
406
403
407
if err = NewIssueWithIndex (ctx , issue .Poster , NewIssueOptions {
404
408
Repo : repo ,
0 commit comments