brendan-duncan/archive

How to handle Exception: `ArchiveException('Invalid GZip Signature')`

Closed this issue · 1 comments

I was trying to decode the bytes using GZipDecoder().decodeBytes and I got this exception:

ArchiveException('Invalid GZip Signature')

How should I handle this exception? I am getting the List<int> data using a decoder method Utf16leBytesToCodeUnitsDecoder(zippedBytes).decodeRest().

Version
Platform: Android
Flutter: 2.10.4
archive: ^3.3.0

Do let me know if more info is required. Thank you!

Hi,

I am closing this issue as I was able to trace the reason for the Exception. It turned out that the conversion that I am doing before decompressing the data is corrupting the bytes. Hence, the algorithm is not able to identify the data as GZip input.

To solve the issue, I directly fed the file data to the GZipDecoder().decodeBytes and then performed the conversion. And things worked as expected. More can learn on this StackOverflow question: How to handle Exception: ArchiveException('Invalid GZip Signature')