tar 3.2.2 → 3.2.3

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
@@ -313,6 +313,20 @@ class Unpack extends Parser {
313
313
  // check if a thing is there, and if so, try to clobber it
314
314
  [CHECKFS] (entry) {
315
315
  this[PEND]()
316
+
317
+ // if we are not creating a directory, and the path is in the dirCache,
318
+ // then that means we are about to delete the directory we created
319
+ // previously, and it is no longer going to be a directory, and neither
320
+ // is any of its children.
321
+ if (entry.type !== 'Directory') {
322
+ for (const path of this.dirCache.keys()) {
323
+ if (path === entry.absolute ||
324
+ path.indexOf(entry.absolute + '/') === 0 ||
325
+ path.indexOf(entry.absolute + '\\') === 0)
326
+ this.dirCache.delete(path)
327
+ }
328
+ }
329
+
316
330
  this[MKDIR](path.dirname(entry.absolute), this.dmode, er => {
317
331
  if (er)
318
332
  return this[ONERROR](er, entry)
@@ -374,6 +388,15 @@ class UnpackSync extends Unpack {
374
388
  }
375
389
 
376
390
  [CHECKFS] (entry) {
391
+ if (entry.type !== 'Directory') {
392
+ for (const path of this.dirCache.keys()) {
393
+ if (path === entry.absolute ||
394
+ path.indexOf(entry.absolute + '/') === 0 ||
395
+ path.indexOf(entry.absolute + '\\') === 0)
396
+ this.dirCache.delete(path)
397
+ }
398
+ }
399
+
377
400
  const er = this[MKDIR](path.dirname(entry.absolute), this.dmode)
378
401
  if (er)
379
402
  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": "3.2.2",
5
+ "version": "3.2.3",
6
6
  "publishConfig": {
7
7
  "tag": "v3-legacy"
8
8
  },