Skip to content

Commit

Permalink
releasesjson: Fix missing Version in unmarshaled response (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko committed Apr 4, 2024
1 parent 73ef503 commit 6d13f0e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions internal/releasesjson/checksum_downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (cd *ChecksumDownloader) DownloadAndVerifyChecksums(ctx context.Context) (C
client := httpclient.NewHTTPClient()
sigURL := fmt.Sprintf("%s/%s/%s/%s", cd.BaseURL,
url.PathEscape(cd.ProductVersion.Name),
url.PathEscape(cd.ProductVersion.RawVersion),
url.PathEscape(cd.ProductVersion.Version.String()),
url.PathEscape(sigFilename))
cd.Logger.Printf("downloading signature from %s", sigURL)

Expand All @@ -76,7 +76,7 @@ func (cd *ChecksumDownloader) DownloadAndVerifyChecksums(ctx context.Context) (C

shasumsURL := fmt.Sprintf("%s/%s/%s/%s", cd.BaseURL,
url.PathEscape(cd.ProductVersion.Name),
url.PathEscape(cd.ProductVersion.RawVersion),
url.PathEscape(cd.ProductVersion.Version.String()),
url.PathEscape(cd.ProductVersion.SHASUMS))
cd.Logger.Printf("downloading checksums from %s", shasumsURL)

Expand Down
3 changes: 1 addition & 2 deletions internal/releasesjson/product_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import "github.com/hashicorp/go-version"
// "consul 0.5.1". A ProductVersion may have one or more builds.
type ProductVersion struct {
Name string `json:"name"`
RawVersion string `json:"version"`
Version *version.Version `json:"-"`
Version *version.Version `json:"version"`
SHASUMS string `json:"shasums,omitempty"`
SHASUMSSig string `json:"shasums_signature,omitempty"`
SHASUMSSigs []string `json:"shasums_signatures,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion internal/releasesjson/releases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestGetProductVersion_includesEnterpriseBuild(t *testing.T) {
testEntVersion.String())
}

if version.RawVersion != testEntVersion.Original() {
if version.Version.String() != testEntVersion.Original() {
t.Fatalf("Expected version %q, got %q", testEntVersion.String(), version.Version.String())
}
}

0 comments on commit 6d13f0e

Please sign in to comment.