mirror of
https://github.com/kubescape/kubescape.git
synced 2026-04-15 06:58:11 +00:00
fix: missing host do not return nil error
Signed-off-by: Mujib Ahasan <ahasanmujib8@gmail.com>
This commit is contained in:
@@ -48,10 +48,14 @@ func NewDefaultDBConfig(grypeURL string) (distribution.Config, installation.Conf
|
||||
finalURL := defaultGrypeListingURL
|
||||
if grypeURL != "" {
|
||||
parsed, err := url.ParseRequestURI(grypeURL)
|
||||
if err != nil || parsed.Host == "" {
|
||||
if err != nil {
|
||||
return distribution.Config{}, installation.Config{}, false, err
|
||||
}
|
||||
|
||||
if parsed.Host == "" {
|
||||
return distribution.Config{}, installation.Config{}, false, fmt.Errorf("invalid grype DB URL: missing host")
|
||||
}
|
||||
|
||||
if parsed.Scheme != "https" && parsed.Scheme != "http" {
|
||||
return distribution.Config{}, installation.Config{}, false, fmt.Errorf("invalid scheme: %s", parsed.Scheme)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user