diff --git a/cmd/csaf_checker/processor.go b/cmd/csaf_checker/processor.go index 18ef49e..ea16c54 100644 --- a/cmd/csaf_checker/processor.go +++ b/cmd/csaf_checker/processor.go @@ -636,6 +636,7 @@ func (p *processor) integrity( if err != nil { return err } + b.Path = "" client := p.httpClient() var data bytes.Buffer @@ -953,7 +954,7 @@ func (p *processor) checkIndex(base string, mask whereType) error { continue } - files = append(files, csaf.DirectoryAdvisoryFile{Path: u}) + files = append(files, csaf.DirectoryAdvisoryFile{Path: bu.JoinPath(u).String()}) } return files, scanner.Err() }() @@ -1036,7 +1037,7 @@ func (p *processor) checkChanges(base string, mask whereType) error { path := r[pathColumn] times, files = append(times, t), - append(files, csaf.DirectoryAdvisoryFile{Path: path}) + append(files, csaf.DirectoryAdvisoryFile{Path: bu.JoinPath(path).String()}) p.timesChanges[path] = t } return times, files, nil diff --git a/internal/misc/url.go b/internal/misc/url.go index 2256a94..fb97a49 100644 --- a/internal/misc/url.go +++ b/internal/misc/url.go @@ -12,6 +12,10 @@ import "net/url" // JoinURL joins the two URLs while preserving the query and fragment part of the latter. func JoinURL(baseURL *url.URL, relativeURL *url.URL) *url.URL { + // Check if we already have an absolute url + if relativeURL.Host != "" && relativeURL.Host != baseURL.Host && relativeURL.Scheme == "https" { + return relativeURL + } u := baseURL.JoinPath(relativeURL.Path) u.RawQuery = relativeURL.RawQuery u.RawFragment = relativeURL.RawFragment