Allow source URLs to contain query parameters

Previously when constructing the signature URL, the `.minisig` suffix was blindly appended to the string version of the source URL.
Now we take the parsed source URL, deep copy it (saves us parsing it twice), and append the `.minisig` suffix to the path component of the URL.
This commit is contained in:
William Elwood 2019-10-31 06:02:05 +00:00 committed by Frank Denis
parent b2ecc45133
commit 0991749b19
1 changed files with 4 additions and 4 deletions

View File

@ -97,13 +97,13 @@ func fetchWithCache(xTransport *XTransport, urlStr string, cacheFile string, ref
dlog.Infof("Loading source information from URL [%s]", urlStr)
var srcURL, sigURL *url.URL
var srcURL *url.URL
if srcURL, err = url.Parse(urlStr); err != nil {
return
}
if sigURL, err = url.Parse(urlStr + ".minisig"); err != nil {
return
}
sigURL := &url.URL{}
*sigURL = *srcURL // deep copy to avoid parsing twice
sigURL.Path += ".minisig"
if bin, err = fetchFromURL(xTransport, srcURL); err != nil {
return
}