Skip to content

Commit 41ff300

Browse files
committed
fix: enclosed_name interprets absolute paths as relative to destination roots
1 parent dcef712 commit 41ff300

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/types.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,12 @@ impl ZipFileData {
603603
let mut depth = 0usize;
604604
for component in path.components() {
605605
match component {
606-
Component::Prefix(_) | Component::RootDir => return None,
606+
Component::Prefix(_) | Component::RootDir => {
607+
if depth > 0 {
608+
return None;
609+
}
610+
// else absolute path becomes relative to destination instead
611+
}
607612
Component::ParentDir => depth = depth.checked_sub(1)?,
608613
Component::Normal(_) => depth += 1,
609614
Component::CurDir => (),

0 commit comments

Comments
 (0)