@zip.js/zip.js 2.18.1 → 2.18.2

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.
@@ -6008,19 +6008,11 @@
6008
6008
  const zip64 = Boolean(extraFieldZip64);
6009
6009
  const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
6010
6010
  const dataDescriptorView = getDataView(dataDescriptorArray);
6011
- const ignoreCrc32 = fileEntry.encrypted && !fileEntry.zipCrypto;
6012
- let localDataDescriptor;
6013
- for (const [zip64Layout, signature] of [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]) {
6014
- const candidate = readDataDescriptor(dataDescriptorView, zip64Layout, signature);
6015
- if (candidate && (ignoreCrc32 || candidate.crc32 == crc32) &&
6016
- candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize) {
6017
- localDataDescriptor = candidate;
6018
- break;
6019
- }
6020
- }
6021
- if (!localDataDescriptor) {
6022
- localDataDescriptor = readDataDescriptor(dataDescriptorView, zip64, false);
6023
- }
6011
+ const candidates = [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]
6012
+ .map(([zip64Layout, signature]) => readDataDescriptor(dataDescriptorView, zip64Layout, signature))
6013
+ .filter(candidate => candidate && candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize);
6014
+ const localDataDescriptor = candidates.find(candidate => candidate.crc32 == crc32) || candidates[0] ||
6015
+ readDataDescriptor(dataDescriptorView, zip64, true) || readDataDescriptor(dataDescriptorView, zip64, false);
6024
6016
  if (localDataDescriptor) {
6025
6017
  fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
6026
6018
  dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
@@ -8937,7 +8929,7 @@
8937
8929
  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8938
8930
  */
8939
8931
 
8940
- const VERSION = "2.18.1";
8932
+ const VERSION = "2.18.2";
8941
8933
 
8942
8934
  /*
8943
8935
  Copyright (c) 2025 Gildas Lormeau. All rights reserved.