Skip to content

Commit

Permalink
Fix Gzip::Compress error for gzip files with extra field
Browse files Browse the repository at this point in the history
  • Loading branch information
kojix2 committed May 1, 2024
1 parent 8b9e299 commit 85456e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/compress/gzip/header.cr
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Compress::Gzip::Header
@os = header[9]

if flg.extra?
xlen = io.read_byte.not_nil!
xlen = io.read_bytes(UInt16, IO::ByteFormat::LittleEndian)
@extra = Bytes.new(xlen)
io.read_fully(@extra)
end
Expand Down Expand Up @@ -86,7 +86,7 @@ class Compress::Gzip::Header
io.write_byte os

unless @extra.empty?
io.write_byte @extra.size.to_u8
io.write_bytes(@extra.size.to_u16, IO::ByteFormat::LittleEndian)
io.write(@extra)
end

Expand Down

0 comments on commit 85456e0

Please sign in to comment.