diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5c1c416e..674a3b37 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,7 +7,7 @@ on: push: branches-ignore: - 'release-plz-**' - - 'dependabot/**' + - 'gh-readonly-queue/**' workflow_dispatch: merge_group: types: [checks_requested] @@ -17,6 +17,7 @@ env: jobs: build_and_test: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name strategy: matrix: os: [ubuntu-latest, macOS-latest, windows-latest] @@ -57,7 +58,8 @@ jobs: command: test args: --all --no-default-features - clippy: + style_and_docs: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name runs-on: ubuntu-latest steps: @@ -68,34 +70,22 @@ jobs: profile: minimal toolchain: nightly override: true - components: clippy - + components: rustfmt, clippy + - name: fmt + run: cargo fmt --all -- --check - name: clippy uses: actions-rs/cargo@v1 with: command: clippy args: --all-targets --all-features -- -D warnings - - check_fmt_and_docs: - name: Checking fmt and docs - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - components: rustfmt, clippy - override: true - - - name: fmt - run: cargo fmt --all -- --check - - - name: Docs - run: cargo doc --no-deps + - name: Docs + run: cargo doc --no-deps fuzz_read: runs-on: ubuntu-latest - + needs: + - build_and_test + - style_and_docs steps: - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 @@ -113,7 +103,7 @@ jobs: command: fuzz args: build --all-features fuzz_read - name: run fuzz - timeout-minutes: 181 + timeout-minutes: 331 uses: actions-rs/cargo@v1 with: command: fuzz @@ -140,7 +130,9 @@ jobs: fuzz_read_with_no_features: runs-on: ubuntu-latest - + needs: + - build_and_test + - style_and_docs steps: - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 @@ -158,11 +150,11 @@ jobs: command: fuzz args: build --no-default-features fuzz_read - name: run fuzz - timeout-minutes: 181 + timeout-minutes: 331 uses: actions-rs/cargo@v1 with: command: fuzz - args: run --no-default-features fuzz_read -- fuzz/corpus/seed -timeout=10s -fork=2 -runs=50000000 -max_total_time=19800 -max_len=16384 -len_control=0 -dict=fuzz/fuzz.dict + args: run --no-default-features fuzz_read -- fuzz/corpus/seed -timeout=10s -fork=2 -runs=40000000 -max_total_time=19800 -max_len=16384 -len_control=0 -dict=fuzz/fuzz.dict - name: Upload any failure inputs if: always() uses: actions/upload-artifact@v4 @@ -185,7 +177,9 @@ jobs: fuzz_write: runs-on: ubuntu-latest - + needs: + - build_and_test + - style_and_docs steps: - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 @@ -203,7 +197,7 @@ jobs: command: fuzz args: build --all-features fuzz_write - name: run fuzz - timeout-minutes: 181 + timeout-minutes: 331 uses: actions-rs/cargo@v1 with: command: fuzz @@ -230,7 +224,9 @@ jobs: fuzz_write_with_no_features: runs-on: ubuntu-latest - + needs: + - build_and_test + - style_and_docs steps: - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 @@ -248,7 +244,7 @@ jobs: command: fuzz args: build --no-default-features fuzz_write - name: run fuzz - timeout-minutes: 181 + timeout-minutes: 331 uses: actions-rs/cargo@v1 with: command: fuzz diff --git a/Cargo.toml b/Cargo.toml index b1085f29..d0164f57 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zip" -version = "1.1.2" +version = "1.1.3" authors = [ "Mathijs van de Nes ", "Marli Frost ", diff --git a/README.md b/README.md index c417c39f..7ce92832 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Info A zip library for rust which supports reading and writing of simple ZIP files. Formerly hosted at -https://github.com/zip-rs/zip. +https://github.com/zip-rs/zip2. Supported compression formats: diff --git a/src/read.rs b/src/read.rs index b1cb0300..0a39faef 100644 --- a/src/read.rs +++ b/src/read.rs @@ -558,7 +558,7 @@ impl ZipArchive { let outpath = directory.as_ref().join(filepath); - if file.name().ends_with('/') { + if file.is_dir() { fs::create_dir_all(&outpath)?; } else { if let Some(p) = outpath.parent() { diff --git a/src/read/stream.rs b/src/read/stream.rs index 80496bcb..f99a0e5a 100644 --- a/src/read/stream.rs +++ b/src/read/stream.rs @@ -67,7 +67,7 @@ impl ZipStreamReader { let outpath = self.0.join(filepath); - if file.name().ends_with('/') { + if file.is_dir() { fs::create_dir_all(&outpath)?; } else { if let Some(p) = outpath.parent() { diff --git a/src/result.rs b/src/result.rs index 98d9943d..f2bb4609 100644 --- a/src/result.rs +++ b/src/result.rs @@ -79,7 +79,15 @@ impl ZipError { impl From for io::Error { fn from(err: ZipError) -> io::Error { - io::Error::new(io::ErrorKind::Other, err) + let kind = match &err { + ZipError::Io(err) => err.kind(), + ZipError::InvalidArchive(_) => io::ErrorKind::InvalidData, + ZipError::UnsupportedArchive(_) => io::ErrorKind::Unsupported, + ZipError::FileNotFound => io::ErrorKind::NotFound, + ZipError::InvalidPassword => io::ErrorKind::InvalidInput, + }; + + io::Error::new(kind, err) } }