@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.
@@ -8019,7 +8019,12 @@
8019
8019
  let { value, readable, writable } = message;
8020
8020
  const transferables = [];
8021
8021
  if (value) {
8022
- message.value = value.buffer;
8022
+ if (value.byteLength < value.buffer.byteLength) {
8023
+ message.value = value.buffer.slice(0, value.byteLength);
8024
+ }
8025
+ else {
8026
+ message.value = value.buffer;
8027
+ }
8023
8028
  transferables.push(message.value);
8024
8029
  }
8025
8030
  if (transferStreams && transferStreamsSupported) {
@@ -9224,10 +9229,14 @@
9224
9229
  }
9225
9230
  directoryDataOffset -= directoryDataLength;
9226
9231
  }
9232
+ if (directoryDataOffset >= reader.size) {
9233
+ prependedDataLength = reader.size - directoryDataOffset - directoryDataLength - END_OF_CENTRAL_DIR_LENGTH;
9234
+ directoryDataOffset = reader.size - directoryDataLength - END_OF_CENTRAL_DIR_LENGTH;
9235
+ }
9227
9236
  if (expectedLastDiskNumber != lastDiskNumber) {
9228
9237
  throw new Error(ERR_SPLIT_ZIP_FILE);
9229
9238
  }
9230
- if (directoryDataOffset < 0 || directoryDataOffset >= reader.size) {
9239
+ if (directoryDataOffset < 0) {
9231
9240
  throw new Error(ERR_BAD_FORMAT);
9232
9241
  }
9233
9242
  let offset = 0;
@@ -9238,7 +9247,7 @@
9238
9247
  if (getUint32(directoryView, offset) != CENTRAL_FILE_HEADER_SIGNATURE && directoryDataOffset != expectedDirectoryDataOffset) {
9239
9248
  const originalDirectoryDataOffset = directoryDataOffset;
9240
9249
  directoryDataOffset = expectedDirectoryDataOffset;
9241
- prependedDataLength = directoryDataOffset - originalDirectoryDataOffset;
9250
+ prependedDataLength += directoryDataOffset - originalDirectoryDataOffset;
9242
9251
  directoryArray = await readUint8Array(reader, directoryDataOffset, directoryDataLength, diskNumber);
9243
9252
  directoryView = getDataView$1(directoryArray);
9244
9253
  }