diff options
author | Cameron Braid <cameron@drivenow.com.au> | 2021-02-04 14:12:25 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-04 04:12:25 +0100 |
commit | 3c965c3e308a9399b6598e9d0f545f4e31fc578d (patch) | |
tree | 97ca058e88315ade3dbad9a14e1b3edd8079078a /routers/api | |
parent | 87009ab40a905b6f7d267f71434fda2a32725c57 (diff) | |
download | gitea-3c965c3e308a9399b6598e9d0f545f4e31fc578d.tar.gz gitea-3c965c3e308a9399b6598e9d0f545f4e31fc578d.zip |
[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>
Diffstat (limited to 'routers/api')
-rw-r--r-- | routers/api/v1/repo/release_tags.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/routers/api/v1/repo/release_tags.go b/routers/api/v1/repo/release_tags.go index ef07ce5e1a..70011a6a8e 100644 --- a/routers/api/v1/repo/release_tags.go +++ b/routers/api/v1/repo/release_tags.go @@ -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 } |