fix: Invalid UTF-8 commit messages in JSON API responses (#37542)

This commit is contained in:
Nicolas
2026-05-07 16:19:45 +02:00
committed by GitHub
parent 2200ed7499
commit c9b9e376fb
54 changed files with 221 additions and 215 deletions
+1 -1
View File
@@ -359,7 +359,7 @@ func SyncBranchesToDB(ctx context.Context, repoID, pusherID int64, branchNames,
RepoID: repoID,
Name: branchName,
CommitID: commit.ID.String(),
CommitMessage: commit.Summary(),
CommitMessage: commit.MessageTitle(),
PusherID: pusherID,
CommitTime: timeutil.TimeStamp(commit.Committer.When.Unix()),
})
+1 -1
View File
@@ -179,7 +179,7 @@ func getFileContentsByEntryInternal(ctx context.Context, repo *repo_model.Reposi
}
}
if opts.IncludeCommitMessage {
contentsResponse.LastCommitMessage = new(lastCommit.Message())
contentsResponse.LastCommitMessage = new(lastCommit.MessageUTF8())
}
}
+1 -1
View File
@@ -110,7 +110,7 @@ func GetFileCommitResponse(repo *repo_model.Repository, commit *git.Commit) (*ap
},
Date: commit.Committer.When.UTC().Format(time.RFC3339),
},
Message: commit.Message(),
Message: commit.MessageUTF8(),
Tree: &api.CommitMeta{
URL: commitTreeURL.String(),
SHA: commit.Tree.ID.String(),
+1 -1
View File
@@ -402,7 +402,7 @@ func pushUpdateAddTags(ctx context.Context, repo *repo_model.Repository, gitRepo
}
rel, has := relMap[lowerTag]
title, note := git.SplitCommitTitleBody(tag.Message, 255)
title, note := git.SplitCommitTitleBody(tag.MessageUTF8(), 255)
if !has {
rel = &repo_model.Release{
RepoID: repo.ID,