@@ -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
}
@@ -381,6 +383,7 @@ func NewIssueWithIndex(ctx context.Context, doer *user_model.User, opts NewIssue
381
383
}
382
384
383
385
// 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.
384
387
func NewIssue (ctx context.Context , repo * repo_model.Repository , issue * Issue , labelIDs []int64 , uuids []string ) (err error ) {
385
388
ctx , committer , err := db .TxContext (ctx )
386
389
if err != nil {
@@ -394,6 +397,7 @@ func NewIssue(ctx context.Context, repo *repo_model.Repository, issue *Issue, la
394
397
}
395
398
396
399
issue .Index = idx
400
+ issue .Title , _ = util .SplitStringAtByteN (issue .Title , 255 )
397
401
398
402
if err = NewIssueWithIndex (ctx , issue .Poster , NewIssueOptions {
399
403
Repo : repo ,
0 commit comments