@zip.js/zip.js 2.7.30 → 2.7.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/zip-full.js CHANGED
@@ -6445,7 +6445,12 @@
6445
6445
  let { value, readable, writable } = message;
6446
6446
  const transferables = [];
6447
6447
  if (value) {
6448
- message.value = value.buffer;
6448
+ if (value.byteLength < value.buffer.byteLength) {
6449
+ message.value = value.buffer.slice(0, value.byteLength);
6450
+ }
6451
+ else {
6452
+ message.value = value.buffer;
6453
+ }
6449
6454
  transferables.push(message.value);
6450
6455
  }
6451
6456
  if (transferStreams && transferStreamsSupported) {
@@ -7593,10 +7598,14 @@
7593
7598
  }
7594
7599
  directoryDataOffset -= directoryDataLength;
7595
7600
  }
7601
+ if (directoryDataOffset >= reader.size) {
7602
+ prependedDataLength = reader.size - directoryDataOffset - directoryDataLength - END_OF_CENTRAL_DIR_LENGTH;
7603
+ directoryDataOffset = reader.size - directoryDataLength - END_OF_CENTRAL_DIR_LENGTH;
7604
+ }
7596
7605
  if (expectedLastDiskNumber != lastDiskNumber) {
7597
7606
  throw new Error(ERR_SPLIT_ZIP_FILE);
7598
7607
  }
7599
- if (directoryDataOffset < 0 || directoryDataOffset >= reader.size) {
7608
+ if (directoryDataOffset < 0) {
7600
7609
  throw new Error(ERR_BAD_FORMAT);
7601
7610
  }
7602
7611
  let offset = 0;
@@ -7607,7 +7616,7 @@
7607
7616
  if (getUint32(directoryView, offset) != CENTRAL_FILE_HEADER_SIGNATURE && directoryDataOffset != expectedDirectoryDataOffset) {
7608
7617
  const originalDirectoryDataOffset = directoryDataOffset;
7609
7618
  directoryDataOffset = expectedDirectoryDataOffset;
7610
- prependedDataLength = directoryDataOffset - originalDirectoryDataOffset;
7619
+ prependedDataLength += directoryDataOffset - originalDirectoryDataOffset;
7611
7620
  directoryArray = await readUint8Array(reader, directoryDataOffset, directoryDataLength, diskNumber);
7612
7621
  directoryView = getDataView$1(directoryArray);
7613
7622
  }