Fix .zip crash when file mode isn't present (#804)

This commit is contained in:
João Marcos 2025-04-20 13:09:48 -03:00 committed by GitHub
parent 739dfa9507
commit 0b122fa05c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -23,6 +23,9 @@ Categories Used:
### New Features
### Improvements
### Bug Fixes
- Fix .zip crash when file mode isn't present [\#804](https://github.com/ouch-org/ouch/pull/804) ([marcospb19](https://github.com/marcospb19))
### Tweaks
## [0.6.0](https://github.com/ouch-org/ouch/compare/0.5.1...0.6.0)

View File

@ -85,10 +85,8 @@ where
));
}
let mode = file.unix_mode().ok_or_else(|| {
std::io::Error::new(std::io::ErrorKind::InvalidData, "Cannot extract file's mode")
})?;
let is_symlink = (mode & 0o170000) == 0o120000;
let mode = file.unix_mode();
let is_symlink = mode.is_some_and(|mode| mode & 0o170000 == 0o120000);
if is_symlink {
let mut target = String::new();