diff --git a/signature.go b/signature.go index 11d05bb..e01c9a1 100644 --- a/signature.go +++ b/signature.go @@ -26,6 +26,8 @@ var ( PDF = []byte{0x25, 0x50, 0x44, 0x46} RAR = []byte{0x52, 0x61, 0x72, 0x21, 0x1A, 0x07, 0x00} GZIP = []byte{0x1F, 0x8B, 0x08} - ZIP = []byte{0x50, 0x4B, 0x03, 0x04} + ZIP_0 = []byte{0x50, 0x4B, 0x03, 0x04} + ZIP_1 = []byte{0x50, 0x4B, 0x05, 0x06} + ZIP_2 = []byte{0x50, 0x4B, 0x07, 0x08} WEBP = []byte{0x52, 0x49, 0x46, 0x46} ) diff --git a/validator.go b/validator.go index bb70a95..5c65487 100644 --- a/validator.go +++ b/validator.go @@ -360,15 +360,17 @@ func IsGzip(r io.ReadSeeker) bool { // IsZip function will return true if File is a valid ZIP func IsZip(r io.ReadSeeker) bool { - l := len(ZIP) + l := len(ZIP_0) buff, err := readUntil(l, r) if err != nil { return false } - valid := bytes.Compare(ZIP, buff) - if valid != 0 { + valid_zip_0 := bytes.Compare(ZIP_0, buff) + valid_zip_1 := bytes.Compare(ZIP_0, buff) + valid_zip_2 := bytes.Compare(ZIP_2, buff) + if valid_zip_0 != 0 && valid_zip_1 != 0 && valid_zip_2 != 0 { return false }