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