From 3b6b2f59a269c0ffabf17d195c4b6e850b722cd7 Mon Sep 17 00:00:00 2001 From: Christoph Herzog Date: Mon, 8 Jul 2024 18:22:50 +0200 Subject: [PATCH] fix(wasix): Fix incorrect webc version mapping --- lib/wasix/src/runtime/resolver/backend_source.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/wasix/src/runtime/resolver/backend_source.rs b/lib/wasix/src/runtime/resolver/backend_source.rs index 3456fbb08f6..04916162749 100644 --- a/lib/wasix/src/runtime/resolver/backend_source.rs +++ b/lib/wasix/src/runtime/resolver/backend_source.rs @@ -364,14 +364,12 @@ fn decode_summary( let WebQueryGetPackageVersion { v2: WebQueryGetPackageVersionDistribution { - webc_version: v2_webc_version, pirita_sha256_hash: v2_pirita_sha256_hash, pirita_download_url: v2_pirita_download_url, webc_manifest: v2_manifest, }, v3: WebQueryGetPackageVersionDistribution { - webc_version: v3_webc_version, pirita_sha256_hash: v3_pirita_sha256_hash, pirita_download_url: v3_pirita_download_url, webc_manifest: v3_manifest, @@ -379,17 +377,17 @@ fn decode_summary( .. } = pkg_version; - let (webc_version, pirita_sha256_hash, pirita_download_url, manifest) = + let (version, pirita_sha256_hash, pirita_download_url, manifest) = if preferred_webc_version == webc::Version::V3 { ( - v3_webc_version, + webc::Version::V3, v3_pirita_sha256_hash, v3_pirita_download_url, v3_manifest, ) } else { ( - v2_webc_version, + webc::Version::V2, v2_pirita_sha256_hash, v2_pirita_download_url, v2_manifest, @@ -413,8 +411,6 @@ fn decode_summary( let webc_sha256 = WebcHash::parse_hex(&hash).context("invalid webc sha256 hash in manifest")?; - let version: webc::Version = webc_version.unwrap_or_default().into(); - Ok(PackageSummary { pkg: PackageInfo::from_manifest(id, &manifest, version)?, dist: DistributionInfo { webc, webc_sha256 }, @@ -705,8 +701,6 @@ impl From for webc::Version { #[derive(Debug, serde::Serialize, serde::Deserialize, Clone)] pub struct WebQueryGetPackageVersionDistribution { - #[serde(rename = "webcVersion")] - pub webc_version: Option, #[serde(rename = "piritaDownloadUrl")] pub pirita_download_url: Option, #[serde(rename = "piritaSha256Hash")]