Skip to content

Commit

Permalink
Fix Windows CI: avoid UNC parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
ncihnegn committed Sep 12, 2022
1 parent f4f439c commit 80bc06f
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/entry.rs
Expand Up @@ -379,12 +379,26 @@ impl<'a> EntryFields<'a> {

let mut file_dst = dst.to_path_buf();
{
let path = self.path().map_err(|e| {
TarError::new(
format!("invalid path in entry header: {}", self.path_lossy()),
e,
)
})?;
let path = if !cfg!(windows) {
self.path()
.map_err(|e| {
TarError::new(
format!("invalid path in entry header: {}", self.path_lossy()),
e,
)
})?
.into_owned()
} else {
// https://github.com/rust-lang/rust/issues/100833
let mut path = self.path_lossy();
while path.starts_with("//") {
path = path
.strip_prefix("//")
.ok_or(other("failed to strip prefix //"))?
.to_string();
}
Path::new(&path).to_path_buf()
};
for part in path.components() {
match part {
// Leading '/' characters, root paths, and '.'
Expand Down

0 comments on commit 80bc06f

Please sign in to comment.