Skip to content

Commit

Permalink
fix(2952): Allow colon to be used in root directory (#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
yk634 authored Nov 30, 2023
1 parent 23cc7ab commit ec83f2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions launch.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func parseScmURI(scmURI, scmName string) (scmPath, error) {
uri := strings.Split(scmURI, ":")
orgRepo := strings.Split(scmName, "/")

if (len(uri) != 3 && len(uri) != 4) || len(orgRepo) != 2 {
if len(uri) < 3 || len(orgRepo) != 2 {
return scmPath{}, fmt.Errorf("Unable to parse scmUri %v and scmName %v", scmURI, scmName)
}

Expand All @@ -218,7 +218,7 @@ func parseScmURI(scmURI, scmName string) (scmPath, error) {
}

if len(uri) > 3 {
parsed.RootDir = uri[3]
parsed.RootDir = strings.Join(uri[3:], ":")
}

return parsed, nil
Expand Down
4 changes: 2 additions & 2 deletions launch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,9 @@ func TestParseScmURI(t *testing.T) {
wantOrg := "screwdriver-cd"
wantRepo := "launcher"
wantBranch := "master"
wantRootDir := "childDirectory"
wantRootDir := "child:Directory"

scmURI := "github.com:123456:master:childDirectory"
scmURI := "github.com:123456:master:child:Directory"
scmName := "screwdriver-cd/launcher"
parsedURL, err := parseScmURI(scmURI, scmName)
host, org, repo, branch, rootDir := parsedURL.Host, parsedURL.Org, parsedURL.Repo, parsedURL.Branch, parsedURL.RootDir
Expand Down

0 comments on commit ec83f2e

Please sign in to comment.