From cbd80881bcb7e5e7674f748edb7f629e3203783f Mon Sep 17 00:00:00 2001 From: jolheiser Date: Tue, 21 Mar 2023 09:54:34 +0800 Subject: [PATCH] Trim space on title (#75) Resolves #74 Reviewed-on: https://gitea.com/gitea/changelog/pulls/75 Reviewed-by: Lunny Xiao Reviewed-by: silverwind Co-authored-by: jolheiser Co-committed-by: jolheiser --- service/gitea.go | 3 ++- service/github.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/service/gitea.go b/service/gitea.go index 874f858..a932f1a 100644 --- a/service/gitea.go +++ b/service/gitea.go @@ -6,6 +6,7 @@ package service import ( "fmt" + "strings" "time" "code.gitea.io/sdk/gitea" @@ -92,7 +93,7 @@ func getGiteaTagURL(c *gitea.Client, baseURL, owner, repo, mileName, gitTag, fro func convertToEntry(issue gitea.Issue) Entry { entry := Entry{ Index: issue.Index, - Title: issue.Title, + Title: strings.TrimSpace(issue.Title), } labels := make([]Label, len(issue.Labels)) diff --git a/service/github.go b/service/github.go index 5a0193d..93119ea 100644 --- a/service/github.go +++ b/service/github.go @@ -9,6 +9,7 @@ import ( "fmt" "net/http" "os" + "strings" "time" "github.com/google/go-github/v50/github" @@ -58,7 +59,7 @@ func (gh *GitHub) Generate() (string, []Entry, error) { for _, pr := range result.Issues { if pr.IsPullRequest() == isPull { p := Entry{ - Title: pr.GetTitle(), + Title: strings.TrimSpace(pr.GetTitle()), Index: int64(pr.GetNumber()), }