Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions ext/vulnsrc/amzn/amzn.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"encoding/xml"
"fmt"
"io"
"net/url"
"regexp"
"strings"

Expand Down Expand Up @@ -194,10 +195,14 @@ func (u *updater) getUpdateInfoURI() (string, error) {
if !success {
log.WithError(err).Error("could not parse mirror list")
}
mirrorURI := scanner.Text()
mirrorURL, err := url.Parse(scanner.Text())
if err != nil {
log.WithError(err).Error("invalid url returned from mirror list")
return "", commonerr.ErrCouldNotDownload
}

// Download repomd.xml.
repoMdURI := mirrorURI + "/repodata/repomd.xml"
repoMdURI := mirrorURL.JoinPath("repodata", "repomd.xml").String()
repoMdResponse, err := httputil.GetWithUserAgent(repoMdURI)
if err != nil {
log.WithError(err).Error("could not download repomd.xml")
Expand All @@ -222,7 +227,7 @@ func (u *updater) getUpdateInfoURI() (string, error) {
var updateInfoURI string
for _, repo := range repoMd.RepoList {
if repo.Type == "updateinfo" {
updateInfoURI = mirrorURI + "/" + repo.Location.Href
updateInfoURI = mirrorURL.JoinPath(repo.Location.Href).String()
break
}
}
Expand Down