Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: soft links should remain the same #201

Merged
Prev Previous commit
Next Next commit
fix: read entire target and dont transform symlink to absoulte
  • Loading branch information
nichmor committed Jun 26, 2024
commit 955ea393eeaacaf7f0a7f26fb6b044231daf9fbe
5 changes: 2 additions & 3 deletions src/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ impl<R: Read + Seek> ZipArchive<R> {
}
let symlink_target = if file.is_symlink() && (cfg!(unix) || cfg!(windows)) {
let mut target = Vec::with_capacity(file.size() as usize);
file.read_exact(&mut target)?;
file.read_to_end(&mut target)?;
Some(target)
} else {
None
Expand All @@ -922,8 +922,7 @@ impl<R: Read + Seek> ZipArchive<R> {
{
use std::os::unix::ffi::OsStringExt;
let target = OsString::from_vec(target);
let target_path = directory.as_ref().join(target);
std::os::unix::fs::symlink(target_path, outpath.as_path())?;
std::os::unix::fs::symlink(&target, outpath.as_path())?;
}
#[cfg(windows)]
{
Expand Down