Skip to content

Commit

Permalink
ostree: fix proxy parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
lzap authored and ezr-ondrej committed Nov 19, 2024
1 parent d7ae209 commit 8a2c23c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/ostree/ostree.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/hex"
"fmt"
"io"
"net"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -158,7 +159,7 @@ func resolveRef(ss SourceSpec) (string, error) {
if err != nil {
return "", NewResolveRefError("error parsing ostree repository location: %v", err)
}
u.Path = path.Join(u.Path, "refs/heads/", ss.Ref)
u.Path = path.Join(u.Path, "refs", "heads", ss.Ref)

transport := http.DefaultTransport.(*http.Transport).Clone()
if u.Scheme == "https" {
Expand Down Expand Up @@ -190,7 +191,12 @@ func resolveRef(ss SourceSpec) (string, error) {
}

if ss.Proxy != "" {
proxyURL, err := url.Parse(ss.URL)
host, port, err := net.SplitHostPort(ss.Proxy)
if err != nil {
return "", NewResolveRefError("error parsing MTLS proxy URL '%s': %v", ss.URL, err)
}

proxyURL, err := url.Parse("http://" + host + ":" + port)
if err != nil {
return "", NewResolveRefError("error parsing MTLS proxy URL '%s': %v", ss.URL, err)
}
Expand Down

0 comments on commit 8a2c23c

Please sign in to comment.