From cf1a66bb1d0279e5d5bdd12c1a194ea59669d6c2 Mon Sep 17 00:00:00 2001 From: kieran Date: Fri, 14 Feb 2025 13:41:32 +0000 Subject: [PATCH] fix: missing hash tag from NIP-94 event --- src/repo/mod.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/repo/mod.rs b/src/repo/mod.rs index f1810a1..f93bd6c 100644 --- a/src/repo/mod.rs +++ b/src/repo/mod.rs @@ -44,7 +44,7 @@ pub struct RepoArtifact { pub metadata: ArtifactMetadata, /// SHA-256 hash of the artifact - pub hash: Option>, + pub hash: Vec, } impl Display for RepoArtifact { @@ -66,6 +66,7 @@ impl TryInto for RepoArtifact { Tag::parse(["f", self.platform.to_string().as_str()])?, Tag::parse(["m", self.content_type.as_str()])?, Tag::parse(["size", self.size.to_string().as_str()])?, + Tag::parse(["x", &hex::encode(self.hash)])? ]); if let RepoResource::Remote(u) = self.location { b = b.tag(Tag::parse(["url", u.as_str()])?); @@ -477,7 +478,7 @@ fn load_artifact(path: &Path) -> Result { } fn load_apk_artifact(path: &Path) -> Result { - let file = std::fs::File::open(path)?; + let file = File::open(path)?; let mut file = std::io::BufReader::new(file); let sig_block = load_signing_block(&mut file)?; @@ -500,7 +501,7 @@ fn load_apk_artifact(path: &Path) -> Result { name: path.file_name().unwrap().to_str().unwrap().to_string(), size: path.metadata()?.len(), location: RepoResource::Local(path.to_path_buf()), - hash: Some(hash_file(path)?), + hash: hash_file(path)?, content_type: "application/vnd.android.package-archive".to_string(), platform: Platform::Android { arch: match lib_arch.iter().next().unwrap().as_str() {