Skip to content

Commit

Permalink
chore: Fix CI failure involving conversion to OsString for symlinks (…
Browse files Browse the repository at this point in the history
…see my comments on #125)
  • Loading branch information
Pr0methean committed May 15, 2024
1 parent f275acf commit c52ec50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,14 +689,18 @@ impl<R: Read + Seek> ZipArchive<R> {
if file.is_symlink() && (cfg!(unix) || cfg!(windows)) {
let mut target = Vec::with_capacity(file.size() as usize);
file.read_exact(&mut target)?;
let target_path: PathBuf = directory.as_ref().join(OsString::try_from(target)?);
let target = OsString::from(target.to_string());

Check failure on line 692 in src/read.rs

View workflow job for this annotation

GitHub Actions / Build and test --no-default-features: ubuntu-latest, stable

`Vec<u8>` doesn't implement `std::fmt::Display`

Check failure on line 692 in src/read.rs

View workflow job for this annotation

GitHub Actions / Build and test --no-default-features: ubuntu-latest, msrv

`Vec<u8>` doesn't implement `std::fmt::Display`

Check failure on line 692 in src/read.rs

View workflow job for this annotation

GitHub Actions / Build and test --no-default-features: macOS-latest, msrv

`Vec<u8>` doesn't implement `std::fmt::Display`

Check failure on line 692 in src/read.rs

View workflow job for this annotation

GitHub Actions / style_and_docs (--no-default-features)

`std::vec::Vec<u8>` doesn't implement `std::fmt::Display`

Check failure on line 692 in src/read.rs

View workflow job for this annotation

GitHub Actions / style_and_docs (--no-default-features)

`std::vec::Vec<u8>` doesn't implement `std::fmt::Display`

Check failure on line 692 in src/read.rs

View workflow job for this annotation

GitHub Actions / Build and test --no-default-features: ubuntu-latest, msrv

`Vec<u8>` doesn't implement `std::fmt::Display`

Check failure on line 692 in src/read.rs

View workflow job for this annotation

GitHub Actions / Build and test --no-default-features: ubuntu-latest, nightly

`Vec<u8>` doesn't implement `std::fmt::Display`

Check failure on line 692 in src/read.rs

View workflow job for this annotation

GitHub Actions / Build and test --no-default-features: macOS-latest, msrv

`Vec<u8>` doesn't implement `std::fmt::Display`
let target_path: PathBuf = directory.as_ref().join(target);
#[cfg(unix)]
{
std::os::unix::fs::symlink(target_path, outpath.as_path())?;
}
#[cfg(windows)]
{
if target_path.is_dir() {
// symlink_dir must be used if this points to another symlink that points to
// a directory.
if let Ok(meta) = std::fs::metadata(target_path)

Check failure on line 702 in src/read.rs

View workflow job for this annotation

GitHub Actions / Build and test --no-default-features: ubuntu-latest, stable

`let` expressions in this position are unstable

Check failure on line 702 in src/read.rs

View workflow job for this annotation

GitHub Actions / Build and test --no-default-features: ubuntu-latest, msrv

`let` expressions in this position are unstable

Check failure on line 702 in src/read.rs

View workflow job for this annotation

GitHub Actions / Build and test : ubuntu-latest, stable

`let` expressions in this position are unstable

Check failure on line 702 in src/read.rs

View workflow job for this annotation

GitHub Actions / Build and test --no-default-features: macOS-latest, msrv

`let` expressions in this position are unstable

Check failure on line 702 in src/read.rs

View workflow job for this annotation

GitHub Actions / style_and_docs (--no-default-features)

`let` expressions in this position are unstable

Check failure on line 702 in src/read.rs

View workflow job for this annotation

GitHub Actions / style_and_docs (--no-default-features)

`let` expressions in this position are unstable

Check failure on line 702 in src/read.rs

View workflow job for this annotation

GitHub Actions / Build and test --no-default-features: ubuntu-latest, msrv

`let` expressions in this position are unstable

Check failure on line 702 in src/read.rs

View workflow job for this annotation

GitHub Actions / Build and test --no-default-features: ubuntu-latest, nightly

`let` expressions in this position are unstable

Check failure on line 702 in src/read.rs

View workflow job for this annotation

GitHub Actions / Build and test --no-default-features: macOS-latest, msrv

`let` expressions in this position are unstable

Check failure on line 702 in src/read.rs

View workflow job for this annotation

GitHub Actions / Build and test : ubuntu-latest, stable

`let` expressions in this position are unstable
&& meta.is_dir() {
std::os::windows::fs::symlink_dir(target_path, outpath.as_path())?;
} else {
std::os::windows::fs::symlink_file(target_path, outpath.as_path())?;
Expand Down
1 change: 1 addition & 0 deletions tests/repro_old423.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use tempdir::TempDir;
#[test]
fn repro_old423() -> zip::result::ZipResult<()> {
use std::io;
use tempdir::TempDir;
use zip::ZipArchive;

let mut v = Vec::new();
Expand Down

0 comments on commit c52ec50

Please sign in to comment.