Skip to content

Commit 1859265

Browse files
committed
fix: correct asset hash logic
1 parent 6e32fee commit 1859265

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

postgresql_archive/src/matcher/postgresql_binaries.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ use semver::Version;
1313
/// * If the asset matcher fails.
1414
#[allow(clippy::unnecessary_wraps)]
1515
pub fn matcher(name: &str, version: &Version) -> crate::Result<bool> {
16-
let expected_name = format!("postgresql-{}-{}.tar.gz", version, target_triple::TARGET);
16+
let target = target_triple::TARGET;
17+
let expected_name = format!("postgresql-{version}-{target}.tar.gz");
1718
Ok(name == expected_name)
1819
}
1920

postgresql_archive/src/repository/github/repository.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,10 @@ impl GitHub {
215215
};
216216

217217
let mut asset_hash: Option<Asset> = None;
218-
for asset in &release.assets {
219-
if asset.name.ends_with(".sha256") {
220-
asset_hash = Some(asset.clone());
218+
let hash_name = format!("{}.sha256", asset.name);
219+
for release_asset in &release.assets {
220+
if release_asset.name == hash_name {
221+
asset_hash = Some(release_asset.clone());
221222
break;
222223
}
223224
}

0 commit comments

Comments
 (0)