tar 6.1.1 → 6.1.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.
Files changed (2) hide show
  1. package/lib/unpack.js +22 -0
  2. package/package.json +1 -1
package/lib/unpack.js CHANGED
@@ -465,6 +465,19 @@ class Unpack extends Parser {
465
465
  }
466
466
 
467
467
  [CHECKFS2] (entry, done) {
468
+ // if we are not creating a directory, and the path is in the dirCache,
469
+ // then that means we are about to delete the directory we created
470
+ // previously, and it is no longer going to be a directory, and neither
471
+ // is any of its children.
472
+ if (entry.type !== 'Directory') {
473
+ for (const path of this.dirCache.keys()) {
474
+ if (path === entry.absolute ||
475
+ path.indexOf(entry.absolute + '/') === 0 ||
476
+ path.indexOf(entry.absolute + '\\') === 0)
477
+ this.dirCache.delete(path)
478
+ }
479
+ }
480
+
468
481
  this[MKDIR](path.dirname(entry.absolute), this.dmode, er => {
469
482
  if (er) {
470
483
  done()
@@ -529,6 +542,15 @@ class Unpack extends Parser {
529
542
 
530
543
  class UnpackSync extends Unpack {
531
544
  [CHECKFS] (entry) {
545
+ if (entry.type !== 'Directory') {
546
+ for (const path of this.dirCache.keys()) {
547
+ if (path === entry.absolute ||
548
+ path.indexOf(entry.absolute + '/') === 0 ||
549
+ path.indexOf(entry.absolute + '\\') === 0)
550
+ this.dirCache.delete(path)
551
+ }
552
+ }
553
+
532
554
  const er = this[MKDIR](path.dirname(entry.absolute), this.dmode, neverCalled)
533
555
  if (er)
534
556
  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": "6.1.1",
5
+ "version": "6.1.2",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/npm/node-tar.git"