brendan-duncan/archive

Failed to decompress the secret zip file

Opened this issue · 2 comments

Flutter stable, 3.7.5
archive: ^3.3.6

my code:

import 'package:archive/archive_io.dart';

...
 Archive archive = ZipDecoder().decodeBytes(
      byteData.buffer.asUint8List(),
      verify: true,
      password: '123456'
  );
...

error:

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: Unsupported operation: Cannot modify an unmodifiable list
#0 _UnmodifiableUint8ArrayView.[]= (dart:typed_data-patch/typed_data_patch.dart:5391:5)
#1 ZipFile._decodeZipCrypto (package:archive/src/zip/zip_file.dart:194:12)
#2 ZipFile.content (package:archive/src/zip/zip_file.dart:131:27)
#3 ZipDecoder.decodeBuffer (package:archive/src/zip_decoder.dart:35:41)
#4 ZipDecoder.decodeBytes (package:archive/src/zip_decoder.dart:16:12)

@brendan-duncan @brendan-duncan-g

if you use ByteData data = await rootBundle.load(dbAsset); to load a zip file, you may counter this problem

Change

var bytes = data.buffer.asUint8List();

to:

var bytes = data.buffer.asUint8List().sublist(0);
fz3hra commented

@wadychou were you able to fix the issue please?