Skip to content

Conversation

LawyZheng
Copy link

#47 try to fix the double gzip

if len(input) < 2 {
return false
}
return input[0] == 0x1f && input[1] == 0x8b

Choose a reason for hiding this comment

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

If you look at the func (z *Reader) readHeader() (hdr Header, err error) on compress/gzip/gunzip.go file it should include the deflate option too, hence this should do it:

var gzipHeader = []byte{0x1f, 0x8b, 0x08}

func IsGzip(b []byte) bool {
        if len(b) < 3 {
                return false
        }

        return bytes.Equal(b[0:3], gzipHeader)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants