summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/label.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/repo/label.go')
-rw-r--r--routers/api/v1/repo/label.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/routers/api/v1/repo/label.go b/routers/api/v1/repo/label.go
index fef6ebf07a..f71683f6ec 100644
--- a/routers/api/v1/repo/label.go
+++ b/routers/api/v1/repo/label.go
@@ -15,6 +15,7 @@ import (
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
+ "code.gitea.io/gitea/modules/web"
"code.gitea.io/gitea/routers/api/v1/utils"
)
@@ -108,7 +109,7 @@ func GetLabel(ctx *context.APIContext) {
}
// CreateLabel create a label for a repository
-func CreateLabel(ctx *context.APIContext, form api.CreateLabelOption) {
+func CreateLabel(ctx *context.APIContext) {
// swagger:operation POST /repos/{owner}/{repo}/labels issue issueCreateLabel
// ---
// summary: Create a label
@@ -137,6 +138,7 @@ func CreateLabel(ctx *context.APIContext, form api.CreateLabelOption) {
// "422":
// "$ref": "#/responses/validationError"
+ form := web.GetForm(ctx).(*api.CreateLabelOption)
form.Color = strings.Trim(form.Color, " ")
if len(form.Color) == 6 {
form.Color = "#" + form.Color
@@ -160,7 +162,7 @@ func CreateLabel(ctx *context.APIContext, form api.CreateLabelOption) {
}
// EditLabel modify a label for a repository
-func EditLabel(ctx *context.APIContext, form api.EditLabelOption) {
+func EditLabel(ctx *context.APIContext) {
// swagger:operation PATCH /repos/{owner}/{repo}/labels/{id} issue issueEditLabel
// ---
// summary: Update a label
@@ -195,6 +197,7 @@ func EditLabel(ctx *context.APIContext, form api.EditLabelOption) {
// "422":
// "$ref": "#/responses/validationError"
+ form := web.GetForm(ctx).(*api.EditLabelOption)
label, err := models.GetLabelInRepoByID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id"))
if err != nil {
if models.IsErrRepoLabelNotExist(err) {