Skip to content

Commit

Permalink
Addressed the review comments
Browse files Browse the repository at this point in the history
Signed-off-by: anandf <anjoseph@redhat.com>
  • Loading branch information
anandf committed Dec 5, 2023
1 parent c204df4 commit 7638510
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 1 addition & 2 deletions util/git/creds.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,7 @@ func (c SSHCreds) Environ() (io.Closer, []string, error) {
if c.proxy != "" {
parsedProxyURL, err := url.Parse(c.proxy)
if err != nil {
log.Errorf("Could not parse proxy URL '%s'", c.proxy)
return nil, nil, err
return nil, nil, fmt.Errorf("failed to set environment variables related to socks5 proxy, could not parse proxy URL '%s': %w", c.proxy, err)
}
args = append(args, "-o", fmt.Sprintf("ProxyCommand='connect-proxy -S %s:%s -5 %%h %%p'",
parsedProxyURL.Hostname(),
Expand Down
10 changes: 7 additions & 3 deletions util/git/workaround.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@ func newClient(url string, insecure bool, creds Creds, proxy string) (transport.
if proxy != "" {
parsedProxyURL, err := neturl.Parse(proxy)
if err != nil {
return nil, nil, err
return nil, nil, fmt.Errorf("failed to create client for url '%s', error parsing proxy url '%s': %w", url, proxy, err)
}
var proxyUsername, proxyPasswd string
if parsedProxyURL.User != nil {
proxyUsername = parsedProxyURL.User.Username()
proxyPasswd, _ = parsedProxyURL.User.Password()
}
proxyPasswd, _ := parsedProxyURL.User.Password()
ep.Proxy = transport.ProxyOptions{
URL: fmt.Sprintf("%s://%s:%s", parsedProxyURL.Scheme, parsedProxyURL.Hostname(), parsedProxyURL.Port()),
Username: parsedProxyURL.User.Username(),
Username: proxyUsername,
Password: proxyPasswd,
}
}
Expand Down

0 comments on commit 7638510

Please sign in to comment.