@zklogic/unzipper 0.13.0 → 0.13.1

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/README.md CHANGED
@@ -60,7 +60,7 @@ async function main() {
60
60
  .stream()
61
61
  .pipe(fs.createWriteStream('firstFile'))
62
62
  .on('error',reject)
63
- .on('finish',resolve)
63
+ .on('close',resolve)
64
64
  });
65
65
  }
66
66
 
@@ -139,7 +139,7 @@ async function main() {
139
139
  .stream()
140
140
  .pipe(fs.createWriteStream('firstFile'))
141
141
  .on('error',reject)
142
- .on('finish',resolve)
142
+ .on('close',resolve)
143
143
  });
144
144
  }
145
145
 
@@ -309,7 +309,7 @@ fs.createReadStream('path/to/archive.zip')
309
309
  const size = entry.vars.uncompressedSize; // There is also compressedSize;
310
310
  if (fileName === "this IS the file I'm looking for") {
311
311
  entry.pipe(fs.createWriteStream('output/path'))
312
- .on('finish',cb);
312
+ .on('close',cb);
313
313
  } else {
314
314
  entry.autodrain();
315
315
  cb();
@@ -157,8 +157,9 @@ module.exports = function centralDirectory(source, options) {
157
157
  // to avoid zip slip (writing outside of the destination), we resolve
158
158
  // the target path, and make sure it's nested in the intended
159
159
  // destination, or not extract it otherwise.
160
- const extractPath = path.join(opts.path, entry.path);
161
- if (extractPath.indexOf(opts.path) != 0) {
160
+ const extractPath = path.join(opts.path, entry.path.replace(/\\/g, '/'));
161
+ const rel = path.relative(opts.path, extractPath);
162
+ if (rel === '' || rel.startsWith('..') || path.isAbsolute(rel)) {
162
163
  return;
163
164
  }
164
165
 
package/lib/extract.js CHANGED
@@ -21,7 +21,8 @@ function Extract (opts) {
21
21
  // NOTE: Need to normalize to forward slashes for UNIX OS's to properly
22
22
  // ignore the zip slipped file entirely
23
23
  const extractPath = path.join(opts.path, entry.path.replace(/\\/g, '/'));
24
- if (extractPath.indexOf(opts.path) != 0) {
24
+ const rel = path.relative(opts.path, extractPath);
25
+ if (rel === '' || rel.startsWith('..') || path.isAbsolute(rel)) {
25
26
  return cb();
26
27
  }
27
28
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@zklogic/unzipper",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "Unzip cross-platform streaming API ",
5
5
  "author": {
6
- "email": "arfankhalil@hotmail.com",
7
6
  "name": "Arfan Khalil Mughal",
7
+ "email": "arfankhalil@hotmail.com",
8
8
  "url": "https://github.com/ArfanKhalilMughal"
9
9
  },
10
10
  "contributors": [
@@ -25,12 +25,25 @@
25
25
  "type": "git",
26
26
  "url": "https://github.com/ArfanKhalilMughal/node-unzipper.git"
27
27
  },
28
+ "forkedFrom": {
29
+ "repository": "https://github.com/ZJONSSON/node-unzipper",
30
+ "author": "Ziggy Jonsson",
31
+ "url": "https://github.com/ZJONSSON"
32
+ },
33
+ "bugs": {
34
+ "email": "arfankhalil@hotmail.com",
35
+ "url": "https://github.com/ArfanKhalilMughal/node-unzipper/issues"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
28
40
  "license": "MIT",
29
41
  "dependencies": {
30
42
  "bluebird": "~3.7.2",
31
43
  "duplexer2": "~0.1.4",
32
- "fs-extra": "^11.2.0",
33
- "graceful-fs": "^4.2.2"
44
+ "fs-extra": "11.3.1",
45
+ "graceful-fs": "^4.2.2",
46
+ "node-int64": "^0.4.0"
34
47
  },
35
48
  "devDependencies": {
36
49
  "@eslint/js": "^9.2.0",