diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2022-03-22 17:29:07 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-22 17:29:07 +0800 |
commit | 2b55422cd71b0b325f054646de5cebf39b72b502 (patch) | |
tree | 27e71f4e6e27fd5bbb2c13a27e572ef0b41a1e6d /routers/api/v1 | |
parent | 80fd25524e13dedbdc3527b32d008de152213a89 (diff) | |
download | gitea-2b55422cd71b0b325f054646de5cebf39b72b502.tar.gz gitea-2b55422cd71b0b325f054646de5cebf39b72b502.zip |
Fix the bug: deploy key with write access can not push (#19010)
Use DeployKeyID to replace the IsDeployKey, then CanWriteCode uses the DeployKeyID to check the write permission.
Diffstat (limited to 'routers/api/v1')
-rw-r--r-- | routers/api/v1/repo/key.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/api/v1/repo/key.go b/routers/api/v1/repo/key.go index 35efa64ad3..568f92d7fb 100644 --- a/routers/api/v1/repo/key.go +++ b/routers/api/v1/repo/key.go @@ -144,7 +144,7 @@ func GetDeployKey(ctx *context.APIContext) { // "200": // "$ref": "#/responses/DeployKey" - key, err := asymkey_model.GetDeployKeyByID(db.DefaultContext, ctx.ParamsInt64(":id")) + key, err := asymkey_model.GetDeployKeyByID(ctx, ctx.ParamsInt64(":id")) if err != nil { if asymkey_model.IsErrDeployKeyNotExist(err) { ctx.NotFound() |