aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/actions/artifacts_utils.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/actions/artifacts_utils.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/actions/artifacts_utils.go')
-rw-r--r--routers/api/actions/artifacts_utils.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/routers/api/actions/artifacts_utils.go b/routers/api/actions/artifacts_utils.go
index 3517d57f78..a4ca5797dc 100644
--- a/routers/api/actions/artifacts_utils.go
+++ b/routers/api/actions/artifacts_utils.go
@@ -34,7 +34,7 @@ func validateArtifactName(ctx *ArtifactContext, artifactName string) bool {
func validateRunID(ctx *ArtifactContext) (*actions.ActionTask, int64, bool) {
task := ctx.ActionTask
- runID := ctx.ParamsInt64("run_id")
+ runID := ctx.PathParamInt64("run_id")
if task.Job.RunID != runID {
log.Error("Error runID not match")
ctx.Error(http.StatusBadRequest, "run-id does not match")
@@ -55,7 +55,7 @@ func validateRunIDV4(ctx *ArtifactContext, rawRunID string) (*actions.ActionTask
}
func validateArtifactHash(ctx *ArtifactContext, artifactName string) bool {
- paramHash := ctx.Params("artifact_hash")
+ paramHash := ctx.PathParam("artifact_hash")
// use artifact name to create upload url
artifactHash := fmt.Sprintf("%x", md5.Sum([]byte(artifactName)))
if paramHash == artifactHash {