aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2019-01-30 18:33:00 +0200
committertechknowlogick <matti@mdranta.net>2019-01-30 11:33:00 -0500
commitfada6968a847f628a6d32ac546e1228838809498 (patch)
treeb0f8c8cd14a5c6e7bbffbc170e52527865a58462 /routers/api
parent8b5f6ced22d510a399bf304915ad77c61d6ce7b3 (diff)
downloadgitea-fada6968a847f628a6d32ac546e1228838809498.tar.gz
gitea-fada6968a847f628a6d32ac546e1228838809498.zip
Fix new release creation API to allow empty target (#5870)
* Fix new release creation API to allow empty target * Add more test cases * Update swagger
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/v1/repo/release.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/routers/api/v1/repo/release.go b/routers/api/v1/repo/release.go
index 3c51e452f2..e622acb30c 100644
--- a/routers/api/v1/repo/release.go
+++ b/routers/api/v1/repo/release.go
@@ -152,6 +152,10 @@ func CreateRelease(ctx *context.APIContext, form api.CreateReleaseOption) {
ctx.ServerError("GetRelease", err)
return
}
+ // If target is not provided use default branch
+ if len(form.Target) == 0 {
+ form.Target = ctx.Repo.Repository.DefaultBranch
+ }
rel = &models.Release{
RepoID: ctx.Repo.Repository.ID,
PublisherID: ctx.User.ID,