We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d97731b commit 266194bCopy full SHA for 266194b
1 file changed
index.js
@@ -272,13 +272,17 @@ exports.extract = function (cwd, opts) {
272
xfs.unlink(name, function () {
273
var srcpath = path.join(cwd, path.join('/', header.linkname))
274
275
- xfs.link(srcpath, name, function (err) {
276
- if (err && err.code === 'EPERM' && opts.hardlinkAsFilesFallback) {
277
- stream = xfs.createReadStream(srcpath)
278
- return onfile()
279
- }
+ xfs.realpath(srcpath, function (err, dst) {
+ if (err || !dst.startsWith(path.resolve(cwd))) return next(new Error(name + ' is not a valid hardlink'))
280
281
- stat(err)
+ xfs.link(dst, name, function (err) {
+ if (err && err.code === 'EPERM' && opts.hardlinkAsFilesFallback) {
+ stream = xfs.createReadStream(srcpath)
+ return onfile()
282
+ }
283
+
284
+ stat(err)
285
+ })
286
})
287
288
}
0 commit comments