diff --git a/api/internal/git/repospec.go b/api/internal/git/repospec.go index 5a935f510..10ebb980a 100644 --- a/api/internal/git/repospec.go +++ b/api/internal/git/repospec.go @@ -125,7 +125,7 @@ func parseGitUrl(n string) ( index := strings.Index(n, gitSuffix) orgRepo = n[0:index] n = n[index+len(gitSuffix):] - if n[0] == '/' { + if len(n) > 0 && n[0] == '/' { n = n[1:] } path, gitRef, gitTimeout, gitSubmodules = peelQuery(n) diff --git a/api/internal/git/repospec_test.go b/api/internal/git/repospec_test.go index 8c9fdf604..2e4404d03 100644 --- a/api/internal/git/repospec_test.go +++ b/api/internal/git/repospec_test.go @@ -182,6 +182,12 @@ func TestNewRepoSpecFromUrl_CloneSpecs(t *testing.T) { absPath: notCloned.String(), ref: "", }, + "t12": { + input: "https://bitbucket.example.com/scm/project/repository.git", + cloneSpec: "https://bitbucket.example.com/scm/project/repository.git", + absPath: notCloned.String(), + ref: "", + }, } for tn, tc := range testcases { t.Run(tn, func(t *testing.T) {