diff options
Diffstat (limited to 'routers/api/v1/user/key.go')
-rw-r--r-- | routers/api/v1/user/key.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/routers/api/v1/user/key.go b/routers/api/v1/user/key.go index d00eec85e4..25bda0444a 100644 --- a/routers/api/v1/user/key.go +++ b/routers/api/v1/user/key.go @@ -7,6 +7,7 @@ import ( "net/http" asymkey_model "code.gitea.io/gitea/models/asymkey" + "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/perm" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/context" @@ -29,7 +30,7 @@ func appendPrivateInformation(apiKey *api.PublicKey, key *asymkey_model.PublicKe if defaultUser.ID == key.OwnerID { apiKey.Owner = convert.ToUser(defaultUser, defaultUser) } else { - user, err := user_model.GetUserByID(key.OwnerID) + user, err := user_model.GetUserByID(db.DefaultContext, key.OwnerID) if err != nil { return apiKey, err } |