Skip to content

Commit

Permalink
fix: server panic on invalid repo url
Browse files Browse the repository at this point in the history
Signed-off-by: Toma Puljak <[email protected]>
  • Loading branch information
Tpuljak committed Sep 26, 2024
1 parent cfe1803 commit 1c72a0b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/gitprovider/git_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ func (a *AbstractGitProvider) ParseStaticGitContext(repoUrl string) (*StaticGitC
path := strings.TrimPrefix(u.Path, "/")
parts := strings.Split(path, "/")

if len(parts) < 2 {
return nil, errors.New("cannot parse git URL: " + repoUrl)
}

repo.Source = u.Host
repo.Owner = parts[0]
repo.Name = parts[1]
Expand Down

0 comments on commit 1c72a0b

Please sign in to comment.