@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.
@@ -26,6 +26,6 @@
26
26
  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
27
  */
28
28
 
29
- const VERSION = "2.18.1";
29
+ const VERSION = "2.18.2";
30
30
 
31
31
  export { VERSION };
@@ -1458,19 +1458,11 @@ async function detectOverlappingEntry({
1458
1458
  const zip64 = Boolean(extraFieldZip64);
1459
1459
  const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
1460
1460
  const dataDescriptorView = getDataView(dataDescriptorArray);
1461
- const ignoreCrc32 = fileEntry.encrypted && !fileEntry.zipCrypto;
1462
- let localDataDescriptor;
1463
- for (const [zip64Layout, signature] of [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]) {
1464
- const candidate = readDataDescriptor(dataDescriptorView, zip64Layout, signature);
1465
- if (candidate && (ignoreCrc32 || candidate.crc32 == crc32) &&
1466
- candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize) {
1467
- localDataDescriptor = candidate;
1468
- break;
1469
- }
1470
- }
1471
- if (!localDataDescriptor) {
1472
- localDataDescriptor = readDataDescriptor(dataDescriptorView, zip64, false);
1473
- }
1461
+ const candidates = [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]
1462
+ .map(([zip64Layout, signature]) => readDataDescriptor(dataDescriptorView, zip64Layout, signature))
1463
+ .filter(candidate => candidate && candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize);
1464
+ const localDataDescriptor = candidates.find(candidate => candidate.crc32 == crc32) || candidates[0] ||
1465
+ readDataDescriptor(dataDescriptorView, zip64, true) || readDataDescriptor(dataDescriptorView, zip64, false);
1474
1466
  if (localDataDescriptor) {
1475
1467
  fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
1476
1468
  dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A JavaScript library to zip and unzip files in the browser, Deno and Node.js",
4
4
  "author": "Gildas Lormeau",
5
5
  "license": "BSD-3-Clause",
6
- "version": "2.18.1",
6
+ "version": "2.18.2",
7
7
  "type": "module",
8
8
  "keywords": [
9
9
  "zip",