Skip to content

Commit d3ab5b2

Browse files
authored
fix: Fixed archive path not resolving absolute and unwrap in hash (#23)
* Fixed archive path not resolving absolute * removed last unwrap from hash
1 parent 2624aa9 commit d3ab5b2

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎client/src/main.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,7 @@ fn pack_archive(
958958
compression: CompressionAlgorithm,
959959
compression_level: CompressionLevel,
960960
) -> anyhow::Result<()> {
961+
let path = std::path::absolute(path)?;
961962
assert!(!path.exists());
962963
assert!(path.parent().map(|p| p.exists() && p.is_dir()) == Some(true));
963964

@@ -1133,6 +1134,7 @@ fn archive_directory(
11331134
algorithm: CompressionAlgorithm,
11341135
level: CompressionLevel,
11351136
) -> anyhow::Result<()> {
1137+
let out_file = std::path::absolute(out_file)?;
11361138
assert!(!out_file.exists(), "output file must not already exist");
11371139
assert!(
11381140
out_file.parent().map(|p| p.exists() && p.is_dir()) == Some(true),

‎common/src/hash.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl Hash {
3838
}
3939

4040
Some(Self {
41-
hash: hash.try_into().unwrap(),
41+
hash: hash.try_into().ok()?,
4242
hash_string: value.to_owned(),
4343
})
4444
}

0 commit comments

Comments
 (0)