Skip to content

Commit

Permalink
fix: server panic on invalid repo url (#1165)
Browse files Browse the repository at this point in the history
Signed-off-by: Toma Puljak <[email protected]>
  • Loading branch information
Tpuljak authored Sep 27, 2024
1 parent 374f1b0 commit 0c2ccb5
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 0c2ccb5

Please sign in to comment.