Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(2952): Allow colon to be used in root directory #469

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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