mirror of
https://github.com/go-gitea/gitea
synced 2025-07-19 16:58:37 +00:00
Refactor names (#31405)
This PR only does "renaming": * `Route` should be `Router` (and chi router is also called "router") * `Params` should be `PathParam` (to distingush it from URL query param, and to match `FormString`) * Use lower case for private functions to avoid exposing or abusing
This commit is contained in:
@@ -55,7 +55,7 @@ func listPublicKeys(ctx *context.APIContext, user *user_model.User) {
|
||||
var count int
|
||||
|
||||
fingerprint := ctx.FormString("fingerprint")
|
||||
username := ctx.Params("username")
|
||||
username := ctx.PathParam("username")
|
||||
|
||||
if fingerprint != "" {
|
||||
var userID int64 // Unrestricted
|
||||
@@ -179,7 +179,7 @@ func GetPublicKey(ctx *context.APIContext) {
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
key, err := asymkey_model.GetPublicKeyByID(ctx, ctx.ParamsInt64(":id"))
|
||||
key, err := asymkey_model.GetPublicKeyByID(ctx, ctx.PathParamInt64(":id"))
|
||||
if err != nil {
|
||||
if asymkey_model.IsErrKeyNotExist(err) {
|
||||
ctx.NotFound()
|
||||
@@ -274,7 +274,7 @@ func DeletePublicKey(ctx *context.APIContext) {
|
||||
return
|
||||
}
|
||||
|
||||
id := ctx.ParamsInt64(":id")
|
||||
id := ctx.PathParamInt64(":id")
|
||||
externallyManaged, err := asymkey_model.PublicKeyIsExternallyManaged(ctx, id)
|
||||
if err != nil {
|
||||
if asymkey_model.IsErrKeyNotExist(err) {
|
||||
|
Reference in New Issue
Block a user