tar 4.4.14 → 4.4.15

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 +23 -0
  2. package/package.json +1 -1
package/lib/unpack.js CHANGED
@@ -414,6 +414,20 @@ class Unpack extends Parser {
414
414
  // check if a thing is there, and if so, try to clobber it
415
415
  [CHECKFS] (entry) {
416
416
  this[PEND]()
417
+
418
+ // if we are not creating a directory, and the path is in the dirCache,
419
+ // then that means we are about to delete the directory we created
420
+ // previously, and it is no longer going to be a directory, and neither
421
+ // is any of its children.
422
+ if (entry.type !== 'Directory') {
423
+ for (const path of this.dirCache.keys()) {
424
+ if (path === entry.absolute ||
425
+ path.indexOf(entry.absolute + '/') === 0 ||
426
+ path.indexOf(entry.absolute + '\\') === 0)
427
+ this.dirCache.delete(path)
428
+ }
429
+ }
430
+
417
431
  this[MKDIR](path.dirname(entry.absolute), this.dmode, er => {
418
432
  if (er)
419
433
  return this[ONERROR](er, entry)
@@ -475,6 +489,15 @@ class UnpackSync extends Unpack {
475
489
  }
476
490
 
477
491
  [CHECKFS] (entry) {
492
+ if (entry.type !== 'Directory') {
493
+ for (const path of this.dirCache.keys()) {
494
+ if (path === entry.absolute ||
495
+ path.indexOf(entry.absolute + '/') === 0 ||
496
+ path.indexOf(entry.absolute + '\\') === 0)
497
+ this.dirCache.delete(path)
498
+ }
499
+ }
500
+
478
501
  const er = this[MKDIR](path.dirname(entry.absolute), this.dmode)
479
502
  if (er)
480
503
  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": "4.4.14",
5
+ "version": "4.4.15",
6
6
  "publishConfig": {
7
7
  "tag": "v4-legacy"
8
8
  },