Browse Source

tested create release

pull/1630/head
Kim Lindhardt Madsen 9 years ago
parent
commit
378e3f3018
  1. 8
      routers/api/v1/repo_releases.go

8
routers/api/v1/repo_releases.go

@ -73,7 +73,7 @@ func ReleaseByName(ctx *middleware.Context) {
func CreateRelease(ctx *middleware.Context, form api.CreateReleaseOption) { func CreateRelease(ctx *middleware.Context, form api.CreateReleaseOption) {
if !ctx.Repo.GitRepo.IsBranchExist(form.Target) { if !ctx.Repo.GitRepo.IsBranchExist(form.Target) {
ctx.Handle(500, "IsBranchExist", errors.New("Branch did not exist, " + form.Target)) ctx.Handle(400, "IsBranchExist", errors.New("Branch did not exist, " + form.Target))
return return
} }
@ -102,7 +102,11 @@ func CreateRelease(ctx *middleware.Context, form api.CreateReleaseOption) {
IsPrerelease: form.IsPrerelease, IsPrerelease: form.IsPrerelease,
} }
models.CreateRelease(ctx.Repo.GitRepo, rel) err = models.CreateRelease(ctx.Repo.GitRepo, rel)
if err != nil {
ctx.Handle(400, "CreateRelease", err)
return
}
ctx.JSON(201, ToApiRelease(rel, ctx.User)) ctx.JSON(201, ToApiRelease(rel, ctx.User))

Loading…
Cancel
Save