Skip to content

Commit

Permalink
fix(clustertool): prevent git@ loop-additions
Browse files Browse the repository at this point in the history
  • Loading branch information
PrivatePuffin committed Oct 25, 2024
1 parent b85e40f commit 8a4ef0c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions clustertool/pkg/initfiles/initfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@ func FormatGitURL(input string) string {
input = "ssh://" + input
}

// Replace "github.com/" with "[email protected]:" if present
input = strings.Replace(input, "github.com/", "[email protected]:", 1)
// If the input does not start with "ssh://", add "ssh://"
if !strings.HasPrefix(input, "ssh://git@") {
input = "ssh://git@" + input
}

// Compile a regex to match and replace the URL pattern
re := regexp.MustCompile(`^ssh://[email protected]:(\w+)/(\w+).git$`)
Expand Down

0 comments on commit 8a4ef0c

Please sign in to comment.