@zip.js/zip.js 2.7.67 → 2.7.69

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
@@ -7120,11 +7120,18 @@
7120
7120
  if (eocdCache && index == size - END_OF_CENTRAL_DIR_LENGTH && length == END_OF_CENTRAL_DIR_LENGTH) {
7121
7121
  return eocdCache;
7122
7122
  }
7123
- const response = await sendRequest(HTTP_METHOD_GET, httpReader, getRangeHeaders(httpReader, index, length));
7124
- if (response.status != 206) {
7125
- throw new Error(ERR_HTTP_RANGE);
7123
+ if (index >= size) {
7124
+ return new Uint8Array();
7125
+ } else {
7126
+ if (index + length > size) {
7127
+ length = size - index;
7128
+ }
7129
+ const response = await sendRequest(HTTP_METHOD_GET, httpReader, getRangeHeaders(httpReader, index, length));
7130
+ if (response.status != 206) {
7131
+ throw new Error(ERR_HTTP_RANGE);
7132
+ }
7133
+ return new Uint8Array(await response.arrayBuffer());
7126
7134
  }
7127
- return new Uint8Array(await response.arrayBuffer());
7128
7135
  } else {
7129
7136
  const { data } = httpReader;
7130
7137
  if (!data) {
@@ -8875,7 +8882,7 @@
8875
8882
  if (zip64) {
8876
8883
  updateZip64ExtraField(fileEntry);
8877
8884
  }
8878
- updateLocalHeader(fileEntry, localHeaderView);
8885
+ updateLocalHeader(fileEntry, localHeaderView, options);
8879
8886
  await skipDiskIfNeeded(writable);
8880
8887
  await writeData(writer, localHeaderArray);
8881
8888
  await blob.stream().pipeTo(writable, { preventClose: true, preventAbort: true, signal });
@@ -9269,6 +9276,10 @@
9269
9276
  arraySet(localHeaderArray, rawExtraFieldNTFS, localHeaderOffset);
9270
9277
  localHeaderOffset += getLength(rawExtraFieldNTFS);
9271
9278
  arraySet(localHeaderArray, rawExtraField, localHeaderOffset);
9279
+ if (dataDescriptor) {
9280
+ setUint32(localHeaderView, HEADER_OFFSET_COMPRESSED_SIZE + 4, 0);
9281
+ setUint32(localHeaderView, HEADER_OFFSET_UNCOMPRESSED_SIZE + 4, 0);
9282
+ }
9272
9283
  return {
9273
9284
  localHeaderArray,
9274
9285
  localHeaderView,
@@ -9375,7 +9386,6 @@
9375
9386
 
9376
9387
  function updateLocalHeader({
9377
9388
  rawFilename,
9378
- dataDescriptor,
9379
9389
  encrypted,
9380
9390
  zip64,
9381
9391
  localExtraFieldZip64Length,
@@ -9388,7 +9398,7 @@
9388
9398
  zip64CompressedSize,
9389
9399
  zip64Offset,
9390
9400
  zip64DiskNumberStart
9391
- }, localHeaderView) {
9401
+ }, localHeaderView, { dataDescriptor }) {
9392
9402
  if (!dataDescriptor) {
9393
9403
  if (!encrypted) {
9394
9404
  setUint32(localHeaderView, HEADER_OFFSET_SIGNATURE + 4, signature);