diff --git a/pkg/inventory/source/source.go b/pkg/inventory/source/source.go index 44d8db0c578095e1d9a5f7450b76d592b4f92d03..fdb6d95c956b7889df5bddb7110b1f5335414244 100644 --- a/pkg/inventory/source/source.go +++ b/pkg/inventory/source/source.go @@ -13,6 +13,7 @@ package source import ( "net/url" "path/filepath" + "strings" "time" gogit "github.com/go-git/go-git/v5" @@ -63,7 +64,10 @@ func repoInfo(projectPath string, source *model.Source) { conf, err := repo.Config() if err == nil { if remote, ok := conf.Remotes["origin"]; ok { - source.Repository = normalizeHttpUrl(remote.URLs[0]) + source.Repository = remote.URLs[0] + if strings.HasPrefix(source.Repository, "http") { + source.Repository = normalizeHttpUrl(source.Repository) + } } } ref, err := repo.Head() @@ -84,7 +88,7 @@ func normalizeHttpUrl(rawUrl string) string { } parsedUrl, err := url.Parse(rawUrl) if err != nil { - return "" + return rawUrl } parsedUrl.User = nil return parsedUrl.String()