mirror of
https://github.com/storytold/craft-libs.git
synced 2026-10-31 15:49:54 +00:00
fix(update): zip 9's entry name is fallible
Fixes the Windows build after the move to zip 9: an entry whose name can't be read counts as unsafe.
This commit is contained in:
1 file changed
+1
-1
@@ -133,7 +133,7 @@ fn extract(file: &Path, destination: &Path) -> Result<(Vec<PathBuf>, Vec<PathBuf
|
||||
let mut entry = archive.by_index(index).map_err(|e| e.to_string())?;
|
||||
let relative = entry.enclosed_name().ok_or("The portable ZIP contains an unsafe path.")?;
|
||||
if relative.components().any(|c| !matches!(c, Component::Normal(_)))
|
||||
|| entry.name().contains(['\\', ':'])
|
||||
|| entry.name().map_or(true, |name| name.contains(['\\', ':']))
|
||||
|| entry.unix_mode().is_some_and(|mode| mode & 0o170000 == 0o120000)
|
||||
{
|
||||
return Err("The portable ZIP contains an unsafe path or link.".into());
|
||||
|
||||
Reference in new issue
Block a user