From 1cd3b6d763549fddcf3e97f91b385061b47e1449 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Fri, 24 Feb 2023 12:11:30 +0800 Subject: [PATCH] Replace more `strings.ReplaceAll` to `safeFilename` (#17) Follow #16. Reviewed-on: https://gitea.com/gitea/act/pulls/17 --- act/runner/step_action_remote.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/act/runner/step_action_remote.go b/act/runner/step_action_remote.go index ba6fc953..ea63e95d 100644 --- a/act/runner/step_action_remote.go +++ b/act/runner/step_action_remote.go @@ -57,7 +57,7 @@ func (sar *stepActionRemote) prepareActionExecutor() common.Executor { } } - actionDir := fmt.Sprintf("%s/%s", sar.RunContext.ActionCacheDir(), strings.ReplaceAll(sar.Step.Uses, "/", "-")) + actionDir := fmt.Sprintf("%s/%s", sar.RunContext.ActionCacheDir(), safeFilename(sar.Step.Uses)) gitClone := stepActionRemoteNewCloneExecutor(git.NewGitCloneExecutorInput{ URL: sar.remoteAction.CloneURL(sar.RunContext.Config.DefaultActionInstance), Ref: sar.remoteAction.Ref, @@ -123,7 +123,7 @@ func (sar *stepActionRemote) main() common.Executor { return sar.RunContext.JobContainer.CopyDir(copyToPath, sar.RunContext.Config.Workdir+string(filepath.Separator)+".", sar.RunContext.Config.UseGitIgnore)(ctx) } - actionDir := fmt.Sprintf("%s/%s", sar.RunContext.ActionCacheDir(), strings.ReplaceAll(sar.Step.Uses, "/", "-")) + actionDir := fmt.Sprintf("%s/%s", sar.RunContext.ActionCacheDir(), safeFilename(sar.Step.Uses)) return sar.runAction(sar, actionDir, sar.remoteAction)(ctx) }),