aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/file.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-06-19 06:32:45 +0800
committerGitHub <noreply@github.com>2024-06-19 06:32:45 +0800
commit43c7a2e7b1c7fb8aa2347d82ad0a6886d6fad9c2 (patch)
treec98c2e1159ee02eb52282811f28a4c31ad222c67 /routers/api/v1/repo/file.go
parent17baf1af10de025a47ade1f16f1e5c51646d7fcf (diff)
downloadgitea-43c7a2e7b1c7fb8aa2347d82ad0a6886d6fad9c2.tar.gz
gitea-43c7a2e7b1c7fb8aa2347d82ad0a6886d6fad9c2.zip
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
Diffstat (limited to 'routers/api/v1/repo/file.go')
-rw-r--r--routers/api/v1/repo/file.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/routers/api/v1/repo/file.go b/routers/api/v1/repo/file.go
index 6ecdc1ff67..42483291fc 100644
--- a/routers/api/v1/repo/file.go
+++ b/routers/api/v1/repo/file.go
@@ -294,7 +294,7 @@ func GetArchive(ctx *context.APIContext) {
}
func archiveDownload(ctx *context.APIContext) {
- uri := ctx.Params("*")
+ uri := ctx.PathParam("*")
aReq, err := archiver_service.NewRequest(ctx.Repo.Repository.ID, ctx.Repo.GitRepo, uri)
if err != nil {
if errors.Is(err, archiver_service.ErrUnknownArchiveFormat{}) {
@@ -393,7 +393,7 @@ func GetEditorconfig(ctx *context.APIContext) {
return
}
- fileName := ctx.Params("filename")
+ fileName := ctx.PathParam("filename")
def, err := ec.GetDefinitionForFilename(fileName)
if def == nil {
ctx.NotFound(err)
@@ -577,7 +577,7 @@ func CreateFile(ctx *context.APIContext) {
Files: []*files_service.ChangeRepoFile{
{
Operation: "create",
- TreePath: ctx.Params("*"),
+ TreePath: ctx.PathParam("*"),
ContentReader: contentReader,
},
},
@@ -681,7 +681,7 @@ func UpdateFile(ctx *context.APIContext) {
ContentReader: contentReader,
SHA: apiOpts.SHA,
FromTreePath: apiOpts.FromPath,
- TreePath: ctx.Params("*"),
+ TreePath: ctx.PathParam("*"),
},
},
Message: apiOpts.Message,
@@ -840,7 +840,7 @@ func DeleteFile(ctx *context.APIContext) {
{
Operation: "delete",
SHA: apiOpts.SHA,
- TreePath: ctx.Params("*"),
+ TreePath: ctx.PathParam("*"),
},
},
Message: apiOpts.Message,
@@ -935,7 +935,7 @@ func GetContents(ctx *context.APIContext) {
return
}
- treePath := ctx.Params("*")
+ treePath := ctx.PathParam("*")
ref := ctx.FormTrim("ref")
if fileList, err := files_service.GetContentsOrList(ctx, ctx.Repo.Repository, treePath, ref); err != nil {