Skip to content

Commit d5e122a

Browse files
authored
fix: Properly convert filepath to URL during unpacking (#96)
1 parent 53f3b72 commit d5e122a

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "pixi-pack"
33
description = "A command line tool to pack and unpack conda environments for easy sharing"
4-
version = "0.3.1"
4+
version = "0.3.2"
55
edition = "2021"
66

77
[features]

src/unpack.rs

+15-1
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,22 @@ async fn create_prefix(channel_dir: &Path, target_prefix: &Path, cache_dir: &Pat
195195
let cache_key = CacheKey::from(&package_record);
196196

197197
let package_path = channel_dir.join(&package_record.subdir).join(&file_name);
198+
let normalized_path = package_path.canonicalize().unwrap();
198199

199-
let url = Url::parse(&format!("file:///{}", file_name)).unwrap();
200+
let url = Url::from_file_path(&normalized_path)
201+
.map_err(|_| {
202+
anyhow!(
203+
"could not convert path to URL: {}",
204+
normalized_path.display()
205+
)
206+
})
207+
.unwrap();
208+
209+
tracing::debug!(
210+
"Extracting package {} with URL {}",
211+
package_record.name.as_normalized(),
212+
url
213+
);
200214

201215
let repodata_record = RepoDataRecord {
202216
package_record,

0 commit comments

Comments
 (0)