[API] GetRelease by tag only return release (#14397)

get release by tag should filter out tag releases to be consistent with list releases and get by id

Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
Cameron Braid 2021-02-04 14:12:25 +11:00 committed by GitHub
parent 87009ab40a
commit 3c965c3e30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -48,14 +48,19 @@ func GetReleaseTag(ctx *context.APIContext) {
release, err := models.GetRelease(ctx.Repo.Repository.ID, tag)
if err != nil {
if models.IsErrReleaseNotExist(err) {
ctx.Error(http.StatusNotFound, "GetRelease", err)
ctx.NotFound()
return
}
ctx.Error(http.StatusInternalServerError, "GetRelease", err)
return
}
if err := release.LoadAttributes(); err != nil {
if release.IsTag {
ctx.NotFound()
return
}
if err = release.LoadAttributes(); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
return
}