Skip to content

Commit

Permalink
🐛 Do not try and parse github repo if owner is set. (#1978)
Browse files Browse the repository at this point in the history
  • Loading branch information
preslavgerchev authored Sep 29, 2023
1 parent 799697f commit 64799d7
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions providers/github/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,15 @@ func (s *Service) detect(asset *inventory.Asset, conn *connection.GithubConnecti
asset.Id = conn.Conf.Type
asset.Name = conn.Conf.Host

if x, ok := conn.Conf.Options["repository"]; ok {
fullRepo := x
repoParts := strings.Split(fullRepo, "/")
conn.Conf.Options["owner"] = repoParts[0]
conn.Conf.Options["repository"] = repoParts[1]
repoOpt := conn.Conf.Options["repository"]
ownerOpt := conn.Conf.Options["owner"]
// try and parse the repo only if the owner isnt explicitly set
if repoOpt != "" && ownerOpt == "" {
repoParts := strings.Split(repoOpt, "/")
if len(repoParts) > 1 {
conn.Conf.Options["owner"] = repoParts[0]
conn.Conf.Options["repository"] = repoParts[1]
}
}

platform, err := conn.PlatformInfo()
Expand Down

0 comments on commit 64799d7

Please sign in to comment.