@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.
@@ -6028,19 +6028,11 @@
6028
6028
  const zip64 = Boolean(extraFieldZip64);
6029
6029
  const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
6030
6030
  const dataDescriptorView = getDataView(dataDescriptorArray);
6031
- const ignoreCrc32 = fileEntry.encrypted && !fileEntry.zipCrypto;
6032
- let localDataDescriptor;
6033
- for (const [zip64Layout, signature] of [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]) {
6034
- const candidate = readDataDescriptor(dataDescriptorView, zip64Layout, signature);
6035
- if (candidate && (ignoreCrc32 || candidate.crc32 == crc32) &&
6036
- candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize) {
6037
- localDataDescriptor = candidate;
6038
- break;
6039
- }
6040
- }
6041
- if (!localDataDescriptor) {
6042
- localDataDescriptor = readDataDescriptor(dataDescriptorView, zip64, false);
6043
- }
6031
+ const candidates = [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]
6032
+ .map(([zip64Layout, signature]) => readDataDescriptor(dataDescriptorView, zip64Layout, signature))
6033
+ .filter(candidate => candidate && candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize);
6034
+ const localDataDescriptor = candidates.find(candidate => candidate.crc32 == crc32) || candidates[0] ||
6035
+ readDataDescriptor(dataDescriptorView, zip64, true) || readDataDescriptor(dataDescriptorView, zip64, false);
6044
6036
  if (localDataDescriptor) {
6045
6037
  fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
6046
6038
  dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
@@ -9055,7 +9047,7 @@
9055
9047
  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9056
9048
  */
9057
9049
 
9058
- const VERSION = "2.18.1";
9050
+ const VERSION = "2.18.2";
9059
9051
 
9060
9052
  /*
9061
9053
  Copyright (c) 2025 Gildas Lormeau. All rights reserved.