archive icon indicating copy to clipboard operation
archive copied to clipboard

FormatException is thrown for encrypted zip file with wrong password

Open daniele-athome opened this issue 8 months ago • 0 comments

I don't know if it's a bug - more of an "API correctness" issue maybe.

If I use a wrong password for decrypting a zip file, the library throws FormatException:

FormatException: Filter error, bad data
#0      _FilterImpl.processed (dart:io-patch/filter_patch.dart:13:71)
#1      _FilterSink.addSlice (dart:io/data_transformer.dart:557:29)
#2      _FilterSink.add (dart:io/data_transformer.dart:537:5)
#3      ZLibDecoder.convert (dart:io/data_transformer.dart:383:9)
#4      Codec.decode (dart:convert/codec.dart:30:34)
#5      _ZLibDecoder.decodeBytes (package:archive/src/codecs/zlib/_zlib_decoder_io.dart:19:27)
#6      ZLibDecoder.decodeBytes (package:archive/src/codecs/zlib_decoder.dart:24:27)
#7      ZipFile.getStream (package:archive/src/codecs/zip/zip_file.dart:229:33)
#8      ArchiveFile.decompress (package:archive/src/archive/archive_file.dart:234:40)
#9      ArchiveFile.getContent (package:archive/src/archive/archive_file.dart:175:7)
#10     ArchiveFile.readBytes (package:archive/src/archive/archive_file.dart:182:20)
#11     ArchiveFile.content (package:archive/src/archive/archive_file.dart:189:28)
#12     AircraftDataReader.validate (package:airborne/helpers/aircraft_data.dart:116:31)
<asynchronous suspension>
#13     _validateAndStoreAircraft (package:airborne/helpers/aircraft_data.dart:327:24)

Shouldn't it throw ArchiveException or something?

daniele-athome avatar Aug 10 '25 09:08 daniele-athome