Skip to content

Commit

Permalink
Remove unreliable warning when reading (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhz2 authored Aug 29, 2024
1 parent 301fb33 commit 07b6381
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
17 changes: 10 additions & 7 deletions src/reader.jl
Original file line number Diff line number Diff line change
Expand Up @@ -603,13 +603,16 @@ function parse_central_directory_headers!(central_dir_buffer::Vector{UInt8}, num
)
end
# Maybe num_entries was too small: See https://github.com/thejoshwolfe/yauzl/issues/60
# In that case just log a warning
if bytesavailable(io_b) 4
if readle(io_b, UInt32) == 0x02014b50
@warn "There may be some entries that are being ignored"
end
skip(io_b, -4)
end
# In that case ignore any potential extra entries.
# Logging a warning here is not part of the zip spec, and causes JET
# to complain.
# Commented out warning:
# if bytesavailable(io_b) ≥ 4
# if readle(io_b, UInt32) == 0x02014b50
# @warn "There may be some entries that are being ignored"
# end
# skip(io_b, -4)
# end

resize!(central_dir_buffer, position(io_b))
entries
Expand Down
3 changes: 2 additions & 1 deletion test/test_reader.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ end
@test isempty(entries)
@test central_dir_offset == 0

# @test_logs (:warn,"There may be some entries that are being ignored")
io = IOBuffer([b"PK\x01\x02"; b"PK\x05\x06"; zeros(UInt8,2*4+4*2+2)])
@test_logs (:warn,"There may be some entries that are being ignored") entries, central_dir_buffer, central_dir_offset = ZipArchives.parse_central_directory(io)
entries, central_dir_buffer, central_dir_offset = ZipArchives.parse_central_directory(io)
@test isempty(entries)
@test central_dir_offset == 0
end
Expand Down

2 comments on commit 07b6381

@nhz2
Copy link
Member Author

@nhz2 nhz2 commented on 07b6381 Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/114118

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v2.2.0 -m "<description of version>" 07b6381be8c860010b924ded7f2b6e151f7df28a
git push origin v2.2.0

Please sign in to comment.