mirror of
https://github.com/go-gitea/gitea.git
synced 2024-09-06 23:44:20 -04:00
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`.5e72526da4/services/repository/push.go (L396-L397)
While the only other usage looks correct:5e72526da4/routers/web/repo/repo.go (L416)
This commit is contained in:
parent
5e72526da4
commit
0ea8de2d07
@ -321,14 +321,9 @@ func pushUpdateAddTags(ctx context.Context, repo *repo_model.Repository, gitRepo
|
|||||||
return nil
|
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{
|
releases, err := db.Find[repo_model.Release](ctx, repo_model.FindReleasesOptions{
|
||||||
RepoID: repo.ID,
|
RepoID: repo.ID,
|
||||||
TagNames: lowerTags,
|
TagNames: tags,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("db.Find[repo_model.Release]: %w", err)
|
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
|
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))
|
newReleases := make([]*repo_model.Release, 0, len(lowerTags)-len(relMap))
|
||||||
|
|
||||||
emailToUser := make(map[string]*user_model.User)
|
emailToUser := make(map[string]*user_model.User)
|
||||||
|
Loading…
Reference in New Issue
Block a user