Skip to content

Commit 82f29ab

Browse files
committed
Convert URLs to expected format
1 parent cb7a155 commit 82f29ab

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

go/extractor/util/registryproxy.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"encoding/json"
55
"fmt"
66
"log/slog"
7+
"net/url"
78
"os"
89
"os/exec"
910
"strings"
@@ -103,12 +104,14 @@ func getEnvVars() []string {
103104
goproxy_servers = append(goproxy_servers, cfg.URL)
104105
slog.Info("Found GOPROXY server", slog.String("url", cfg.URL))
105106
} else if cfg.Type == GIT_SOURCE {
106-
if strings.HasSuffix(cfg.URL, "*") {
107-
git_sources = append(git_sources, cfg.URL)
107+
parsed, err := url.Parse(cfg.URL)
108+
if err == nil && parsed.Hostname() != "" {
109+
git_source := parsed.Hostname() + parsed.Path + "*"
110+
git_sources = append(git_sources, git_source)
111+
slog.Info("Found Git source", slog.String("source", git_source))
108112
} else {
109-
git_sources = append(git_sources, cfg.URL+"*")
113+
slog.Warn("Not a valid URL for Git source", slog.String("url", cfg.URL))
110114
}
111-
slog.Info("Found Git source", slog.String("url", cfg.URL))
112115
}
113116
}
114117

0 commit comments

Comments
 (0)