tar 5.0.6 → 5.0.7

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.
Files changed (2) hide show
  1. package/lib/unpack.js +22 -0
  2. package/package.json +1 -1
package/lib/unpack.js CHANGED
@@ -461,6 +461,19 @@ class Unpack extends Parser {
461
461
  this.reservations.reserve(paths, done => this[CHECKFS2](entry, done))
462
462
  }
463
463
  [CHECKFS2] (entry, done) {
464
+ // if we are not creating a directory, and the path is in the dirCache,
465
+ // then that means we are about to delete the directory we created
466
+ // previously, and it is no longer going to be a directory, and neither
467
+ // is any of its children.
468
+ if (entry.type !== 'Directory') {
469
+ for (const path of this.dirCache.keys()) {
470
+ if (path === entry.absolute ||
471
+ path.indexOf(entry.absolute + '/') === 0 ||
472
+ path.indexOf(entry.absolute + '\\') === 0)
473
+ this.dirCache.delete(path)
474
+ }
475
+ }
476
+
464
477
  this[MKDIR](path.dirname(entry.absolute), this.dmode, er => {
465
478
  if (er) {
466
479
  done()
@@ -528,6 +541,15 @@ class UnpackSync extends Unpack {
528
541
  }
529
542
 
530
543
  [CHECKFS] (entry) {
544
+ if (entry.type !== 'Directory') {
545
+ for (const path of this.dirCache.keys()) {
546
+ if (path === entry.absolute ||
547
+ path.indexOf(entry.absolute + '/') === 0 ||
548
+ path.indexOf(entry.absolute + '\\') === 0)
549
+ this.dirCache.delete(path)
550
+ }
551
+ }
552
+
531
553
  const er = this[MKDIR](path.dirname(entry.absolute), this.dmode, neverCalled)
532
554
  if (er)
533
555
  return this[ONERROR](er, entry)
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
3
3
  "name": "tar",
4
4
  "description": "tar for node",
5
- "version": "5.0.6",
5
+ "version": "5.0.7",
6
6
  "publishConfig": {
7
7
  "tag": "v5-legacy"
8
8
  },