archive icon indicating copy to clipboard operation
archive copied to clipboard

Failed to decompress the secret zip file

Open wadychou opened this issue 1 year ago • 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

wadychou avatar Mar 27 '23 16:03 wadychou

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);

richshaw2015 avatar May 08 '23 08:05 richshaw2015

@wadychou were you able to fix the issue please?

fz3hra avatar May 28 '23 12:05 fz3hra