Skip to content

Commit

Permalink
Merge pull request jamestelfer#51 from cultureamp/translation-fix
Browse files Browse the repository at this point in the history
fix: incorrect ssh-https URL translation
  • Loading branch information
jamestelfer authored Jun 1, 2024
2 parents 60c6a85 + a232a97 commit 0ab4679
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/vendor/vendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func New(
}
}

var sshUrl = regexp.MustCompile(`^git@github.com:([^/].+)$`)
var sshUrl = regexp.MustCompile(`^git@github\.com:([^/].+)$`)

func TranslateSSHToHTTPS(url string) string {
groups := sshUrl.FindStringSubmatch(url)
Expand Down
9 changes: 7 additions & 2 deletions internal/vendor/vendor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ func TestTransformSSHToHTTPS(t *testing.T) {
url: "git@githab.com:organization/chinmina.git",
expected: "git@githab.com:organization/chinmina.git",
},
{
name: "ssh, another different host",
url: "git@githubxcom:organization/chinmina.git",
expected: "git@githubxcom:organization/chinmina.git",
},
{
name: "ssh, invalid path specifier",
url: "git@github.com/organization/chinmina.git",
Expand All @@ -195,8 +200,8 @@ func TestTransformSSHToHTTPS(t *testing.T) {
},
{
name: "https, nonsense",
url: "https://github.com/organization/chinmina.git",
expected: "https://github.com/organization/chinmina.git",
url: "https://githubxcom/passthrough.git",
expected: "https://githubxcom/passthrough.git",
},
{
name: "http, valid",
Expand Down

0 comments on commit 0ab4679

Please sign in to comment.