diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 69d40f5..0f2018a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -16,33 +16,33 @@ jobs: fail-fast: false matrix: version: - - '1.6' - '1' - - '~1.11.0-0' + - 'pre' os: - ubuntu-latest - - macOS-13 # intel - - macOS-14 # arm - windows-latest arch: - 'x64' - 'x86' - - 'aarch64' - exclude: + include: - os: ubuntu-latest - arch: aarch64 - - os: windows-latest - arch: aarch64 - - os: macOS-13 + version: '1.6' + arch: x64 + - os: ubuntu-latest + version: '1.6' arch: x86 - os: macOS-13 - arch: aarch64 - - os: macOS-14 - arch: x86 - - os: macOS-14 + version: '1' + arch: x64 + - os: macOS-13 + version: 'pre' arch: x64 - os: macOS-14 - version: '1.6' + version: '1' + arch: aarch64 + - os: macOS-14 + version: 'pre' + arch: aarch64 steps: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v2 diff --git a/Project.toml b/Project.toml index 24c7b44..857afe7 100644 --- a/Project.toml +++ b/Project.toml @@ -16,6 +16,6 @@ ArgCheck = "2" CodecZlib = "0.7" InputBuffers = "1" PrecompileTools = "1" -TranscodingStreams = "0.10.5, 0.11" +TranscodingStreams = "0.9, 0.10, 0.11" Zlib_jll = "1" julia = "1.6.0" diff --git a/src/writer.jl b/src/writer.jl index db7b26a..828e153 100644 --- a/src/writer.jl +++ b/src/writer.jl @@ -220,10 +220,11 @@ function zip_newfile(w::ZipWriter, name::AbstractString; throw(ArgumentError("compression_method must be Deflate or Store")) end pe.bit_flags |= level_bits - w.transcoder = TranscodingStream(codec, io; sharedbuf=false, stop_on_end=true) pe.method = real_compression_method - write_local_header(io, pe) + # io is a WriteOffsetTracker so it is protected from closing + # the underlying IO, or sharing buffers incorrectly. + w.transcoder = TranscodingStream(codec, io) w.partial_entry = pe @assert iswritable(w) nothing @@ -277,7 +278,7 @@ Base.isreadable(w::WriteOffsetTracker) = false # All writes to the underlying IO go through this function. # This enables ZipWriter when using zip_writefile to write to any IO that -# supports Base.unsafe_write and Base.isopen +# supports Base.unsafe_write function Base.unsafe_write(w::WriteOffsetTracker, p::Ptr{UInt8}, n::UInt)::Int (n > typemax(Int)) && throw(ArgumentError("too many bytes. Tried to write $n bytes")) (w.offset < 0) && throw(ArgumentError("initial offset was negative"))