@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.
package/index-native.cjs CHANGED
@@ -6022,19 +6022,11 @@ async function detectOverlappingEntry({
6022
6022
  const zip64 = Boolean(extraFieldZip64);
6023
6023
  const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
6024
6024
  const dataDescriptorView = getDataView(dataDescriptorArray);
6025
- const ignoreCrc32 = fileEntry.encrypted && !fileEntry.zipCrypto;
6026
- let localDataDescriptor;
6027
- for (const [zip64Layout, signature] of [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]) {
6028
- const candidate = readDataDescriptor(dataDescriptorView, zip64Layout, signature);
6029
- if (candidate && (ignoreCrc32 || candidate.crc32 == crc32) &&
6030
- candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize) {
6031
- localDataDescriptor = candidate;
6032
- break;
6033
- }
6034
- }
6035
- if (!localDataDescriptor) {
6036
- localDataDescriptor = readDataDescriptor(dataDescriptorView, zip64, false);
6037
- }
6025
+ const candidates = [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]
6026
+ .map(([zip64Layout, signature]) => readDataDescriptor(dataDescriptorView, zip64Layout, signature))
6027
+ .filter(candidate => candidate && candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize);
6028
+ const localDataDescriptor = candidates.find(candidate => candidate.crc32 == crc32) || candidates[0] ||
6029
+ readDataDescriptor(dataDescriptorView, zip64, true) || readDataDescriptor(dataDescriptorView, zip64, false);
6038
6030
  if (localDataDescriptor) {
6039
6031
  fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
6040
6032
  dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
@@ -9049,7 +9041,7 @@ function formatSupported(StreamClass, format) {
9049
9041
  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9050
9042
  */
9051
9043
 
9052
- const VERSION = "2.18.1";
9044
+ const VERSION = "2.18.2";
9053
9045
 
9054
9046
  /*
9055
9047
  Copyright (c) 2025 Gildas Lormeau. All rights reserved.