Skip to content

Commit 0b122fa

Browse files
authored
Fix .zip crash when file mode isn't present (#804)
1 parent 739dfa9 commit 0b122fa

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ Categories Used:
2323
### New Features
2424
### Improvements
2525
### Bug Fixes
26+
27+
- Fix .zip crash when file mode isn't present [\#804](https://github.com/ouch-org/ouch/pull/804) ([marcospb19](https://github.com/marcospb19))
28+
2629
### Tweaks
2730

2831
## [0.6.0](https://github.com/ouch-org/ouch/compare/0.5.1...0.6.0)

src/archive/zip.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,8 @@ where
8585
));
8686
}
8787

88-
let mode = file.unix_mode().ok_or_else(|| {
89-
std::io::Error::new(std::io::ErrorKind::InvalidData, "Cannot extract file's mode")
90-
})?;
91-
let is_symlink = (mode & 0o170000) == 0o120000;
88+
let mode = file.unix_mode();
89+
let is_symlink = mode.is_some_and(|mode| mode & 0o170000 == 0o120000);
9290

9391
if is_symlink {
9492
let mut target = String::new();

0 commit comments

Comments
 (0)