diff options
author | Jason Song <i@wolfogre.com> | 2024-02-19 18:09:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-19 10:09:36 +0000 |
commit | f79530c50ee1c7833cae13e56531e5d1fd66f5ba (patch) | |
tree | ae2d50fa020c4b01ff13e5f70ee98bf12484b9d9 /services/repository | |
parent | 39735c43a8b6f7db3b3e3531ca9115a60335d524 (diff) | |
download | gitea-f79530c50ee1c7833cae13e56531e5d1fd66f5ba.tar.gz gitea-f79530c50ee1c7833cae13e56531e5d1fd66f5ba.zip |
Do not use lower tag names to find releases/tags (#29261) (#29262)
Backport #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')
-rw-r--r-- | services/repository/push.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/services/repository/push.go b/services/repository/push.go index 90aac95323..6e8f2d4640 100644 --- a/services/repository/push.go +++ b/services/repository/push.go @@ -315,12 +315,7 @@ 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 := repo_model.GetReleasesByRepoIDAndNames(ctx, repo.ID, lowerTags) + releases, err := repo_model.GetReleasesByRepoIDAndNames(ctx, repo.ID, tags) if err != nil { return fmt.Errorf("GetReleasesByRepoIDAndNames: %w", err) } @@ -329,6 +324,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) |