From a8beca2c0878afdd08a441009446b26a3de6f9e4 Mon Sep 17 00:00:00 2001 From: tommady Date: Mon, 14 Apr 2025 08:50:43 +0000 Subject: [PATCH] fix windows ci run failed Signed-off-by: tommady --- src/archive/zip.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/archive/zip.rs b/src/archive/zip.rs index 260d307..d593477 100644 --- a/src/archive/zip.rs +++ b/src/archive/zip.rs @@ -238,7 +238,9 @@ where } }; + #[cfg(unix)] let mode = metadata.permissions().mode(); + let entry_name = path.to_str().ok_or_else(|| { FinalError::with_title("Zip requires that all directories names are valid UTF-8") .detail(format!("File at '{path:?}' has a non-UTF-8 name")) @@ -255,7 +257,11 @@ where // This approach writes the symlink target path as the content of the symlink entry. // We detect symlinks during extraction by checking for the Unix symlink mode (0o120000) in the entry's permissions. + #[cfg(unix)] let symlink_options = options.unix_permissions(0o120000 | (mode & 0o777)); + #[cfg(windows)] + let symlink_options = options.unix_permissions(0o120777); + writer.add_symlink(entry_name, target_name, symlink_options)?; } else { #[cfg(not(unix))]