From ae5388dd797d9f6a0c07bca07cead78f172ce5b1 Mon Sep 17 00:00:00 2001 From: blakebarnett Date: Mon, 24 May 2021 13:04:29 -0700 Subject: [PATCH] fix: replace colons in addition to slashes in app tmp directory (#6290) (#6293) closes https://github.com/argoproj/argo-cd/issues/6290 Signed-off-by: Blake Barnett --- util/git/client.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/git/client.go b/util/git/client.go index 162b54113f..968eb97e41 100644 --- a/util/git/client.go +++ b/util/git/client.go @@ -9,6 +9,7 @@ import ( "os" "os/exec" "path/filepath" + "regexp" "sort" "strconv" "strings" @@ -120,7 +121,8 @@ func WithEventHandlers(handlers EventHandlers) ClientOpts { } func NewClient(rawRepoURL string, creds Creds, insecure bool, enableLfs bool, opts ...ClientOpts) (Client, error) { - root := filepath.Join(os.TempDir(), strings.Replace(NormalizeGitURL(rawRepoURL), "/", "_", -1)) + r := regexp.MustCompile("(/|:)") + root := filepath.Join(os.TempDir(), r.ReplaceAllString(NormalizeGitURL(rawRepoURL), "_")) if root == os.TempDir() { return nil, fmt.Errorf("Repository '%s' cannot be initialized, because its root would be system temp at %s", rawRepoURL, root) }