summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/user/key.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/user/key.go')
-rw-r--r--routers/api/v1/user/key.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/routers/api/v1/user/key.go b/routers/api/v1/user/key.go
index fa16df1836..df8a11c61f 100644
--- a/routers/api/v1/user/key.go
+++ b/routers/api/v1/user/key.go
@@ -12,6 +12,7 @@ import (
"code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
+ "code.gitea.io/gitea/modules/web"
"code.gitea.io/gitea/routers/api/v1/repo"
"code.gitea.io/gitea/routers/api/v1/utils"
)
@@ -204,7 +205,7 @@ func CreateUserPublicKey(ctx *context.APIContext, form api.CreateKeyOption, uid
}
// CreatePublicKey create one public key for me
-func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
+func CreatePublicKey(ctx *context.APIContext) {
// swagger:operation POST /user/keys user userCurrentPostKey
// ---
// summary: Create a public key
@@ -223,7 +224,8 @@ func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
// "422":
// "$ref": "#/responses/validationError"
- CreateUserPublicKey(ctx, form, ctx.User.ID)
+ form := web.GetForm(ctx).(*api.CreateKeyOption)
+ CreateUserPublicKey(ctx, *form, ctx.User.ID)
}
// DeletePublicKey delete one public key