Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarcy Clarke <darcy@darcyclarke.me>2021-07-27 23:52:57 +0300
committerRichard Lau <rlau@redhat.com>2021-07-28 21:39:03 +0300
commitacf5279c3934b55480567b2c30ac63ad7256822a (patch)
treedb5601c5931f41614133f5d31499ad1ef26f1d94 /deps/npm/node_modules/tar/lib/unpack.js
parentd48b91ea2b27828ceea10dab1effa42bc542be03 (diff)
deps: upgrade npm to 6.14.14
PR-URL: https://github.com/nodejs/node/pull/39553 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Diffstat (limited to 'deps/npm/node_modules/tar/lib/unpack.js')
-rw-r--r--deps/npm/node_modules/tar/lib/unpack.js32
1 files changed, 28 insertions, 4 deletions
diff --git a/deps/npm/node_modules/tar/lib/unpack.js b/deps/npm/node_modules/tar/lib/unpack.js
index fc765096efd..3a29a65142e 100644
--- a/deps/npm/node_modules/tar/lib/unpack.js
+++ b/deps/npm/node_modules/tar/lib/unpack.js
@@ -9,6 +9,7 @@ const path = require('path')
const mkdir = require('./mkdir.js')
const mkdirSync = mkdir.sync
const wc = require('./winchars.js')
+const stripAbsolutePath = require('./strip-absolute-path.js')
const ONENTRY = Symbol('onEntry')
const CHECKFS = Symbol('checkFs')
@@ -195,10 +196,10 @@ class Unpack extends Parser {
// absolutes on posix are also absolutes on win32
// so we only need to test this one to get both
- if (path.win32.isAbsolute(p)) {
- const parsed = path.win32.parse(p)
- this.warn('stripping ' + parsed.root + ' from absolute path', p)
- entry.path = p.substr(parsed.root.length)
+ const s = stripAbsolutePath(p)
+ if (s[0]) {
+ entry.path = s[1]
+ this.warn(`stripping ${s[0]} from absolute path`, p)
}
}
@@ -413,6 +414,20 @@ class Unpack extends Parser {
// check if a thing is there, and if so, try to clobber it
[CHECKFS] (entry) {
this[PEND]()
+
+ // if we are not creating a directory, and the path is in the dirCache,
+ // then that means we are about to delete the directory we created
+ // previously, and it is no longer going to be a directory, and neither
+ // is any of its children.
+ if (entry.type !== 'Directory') {
+ for (const path of this.dirCache.keys()) {
+ if (path === entry.absolute ||
+ path.indexOf(entry.absolute + '/') === 0 ||
+ path.indexOf(entry.absolute + '\\') === 0)
+ this.dirCache.delete(path)
+ }
+ }
+
this[MKDIR](path.dirname(entry.absolute), this.dmode, er => {
if (er)
return this[ONERROR](er, entry)
@@ -474,6 +489,15 @@ class UnpackSync extends Unpack {
}
[CHECKFS] (entry) {
+ if (entry.type !== 'Directory') {
+ for (const path of this.dirCache.keys()) {
+ if (path === entry.absolute ||
+ path.indexOf(entry.absolute + '/') === 0 ||
+ path.indexOf(entry.absolute + '\\') === 0)
+ this.dirCache.delete(path)
+ }
+ }
+
const er = this[MKDIR](path.dirname(entry.absolute), this.dmode)
if (er)
return this[ONERROR](er, entry)