From 1252e551b8672b1e16dc8835d6ed82c2de2c3a0c Mon Sep 17 00:00:00 2001 From: Jason Song Date: Fri, 24 Feb 2023 14:20:34 +0800 Subject: [PATCH] Replace more `strings.ReplaceAll` to `safeFilename` (#18) Follow #16 #17 Reviewed-on: https://gitea.com/gitea/act/pulls/18 --- pkg/runner/action.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/runner/action.go b/pkg/runner/action.go index 119764b..4f6f15a 100644 --- a/pkg/runner/action.go +++ b/pkg/runner/action.go @@ -473,7 +473,7 @@ func runPreStep(step actionStep) common.Executor { var actionPath string if _, ok := step.(*stepActionRemote); ok { actionPath = newRemoteAction(stepModel.Uses).Path - actionDir = fmt.Sprintf("%s/%s", rc.ActionCacheDir(), strings.ReplaceAll(stepModel.Uses, "/", "-")) + actionDir = fmt.Sprintf("%s/%s", rc.ActionCacheDir(), safeFilename(stepModel.Uses)) } else { actionDir = filepath.Join(rc.Config.Workdir, stepModel.Uses) actionPath = "" @@ -559,7 +559,7 @@ func runPostStep(step actionStep) common.Executor { var actionPath string if _, ok := step.(*stepActionRemote); ok { actionPath = newRemoteAction(stepModel.Uses).Path - actionDir = fmt.Sprintf("%s/%s", rc.ActionCacheDir(), strings.ReplaceAll(stepModel.Uses, "/", "-")) + actionDir = fmt.Sprintf("%s/%s", rc.ActionCacheDir(), safeFilename(stepModel.Uses)) } else { actionDir = filepath.Join(rc.Config.Workdir, stepModel.Uses) actionPath = ""