aboutsummaryrefslogtreecommitdiffstats
path: root/services/repository/push.go
diff options
context:
space:
mode:
authorJason Song <i@wolfogre.com>2024-02-19 17:31:36 +0800
committerGitHub <noreply@github.com>2024-02-19 09:31:36 +0000
commit0ea8de2d0729e1e1d0ea9de1e59fbcb673e87fd2 (patch)
treed9412bd9ab6651973a6a63a071feaa2d85faf2d4 /services/repository/push.go
parent5e72526da4e915791f03af056890e16821bde052 (diff)
downloadgitea-0ea8de2d0729e1e1d0ea9de1e59fbcb673e87fd2.tar.gz
gitea-0ea8de2d0729e1e1d0ea9de1e59fbcb673e87fd2.zip
Do not use lower tag names to find releases/tags (#29261)
Fix #26090, see https://github.com/go-gitea/gitea/issues/26090#issuecomment-1952013206 Since `TagName` stores the original tag name and `LowerTagName` stores the lower tag name, it doesn't make sense to use lowercase tags as `TagNames` in `FindReleasesOptions`. https://github.com/go-gitea/gitea/blob/5e72526da4e915791f03af056890e16821bde052/services/repository/push.go#L396-L397 While the only other usage looks correct: https://github.com/go-gitea/gitea/blob/5e72526da4e915791f03af056890e16821bde052/routers/web/repo/repo.go#L416
Diffstat (limited to 'services/repository/push.go')
-rw-r--r--services/repository/push.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/services/repository/push.go b/services/repository/push.go
index bedcf6f252..c76025b6a7 100644
--- a/services/repository/push.go
+++ b/services/repository/push.go
@@ -321,14 +321,9 @@ func pushUpdateAddTags(ctx context.Context, repo *repo_model.Repository, gitRepo
return nil
}
- lowerTags := make([]string, 0, len(tags))
- for _, tag := range tags {
- lowerTags = append(lowerTags, strings.ToLower(tag))
- }
-
releases, err := db.Find[repo_model.Release](ctx, repo_model.FindReleasesOptions{
RepoID: repo.ID,
- TagNames: lowerTags,
+ TagNames: tags,
})
if err != nil {
return fmt.Errorf("db.Find[repo_model.Release]: %w", err)
@@ -338,6 +333,11 @@ func pushUpdateAddTags(ctx context.Context, repo *repo_model.Repository, gitRepo
relMap[rel.LowerTagName] = rel
}
+ lowerTags := make([]string, 0, len(tags))
+ for _, tag := range tags {
+ lowerTags = append(lowerTags, strings.ToLower(tag))
+ }
+
newReleases := make([]*repo_model.Release, 0, len(lowerTags)-len(relMap))
emailToUser := make(map[string]*user_model.User)