From 67c25beccf5e11ad6dca21f14fcfc5298873246b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Smyrek?= <56868128+psmyrek@users.noreply.github.com> Date: Thu, 25 Jul 2024 13:45:01 +0200 Subject: [PATCH] Update index.js --- index.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/index.js b/index.js index 9843751..ebb95b9 100644 --- a/index.js +++ b/index.js @@ -261,19 +261,18 @@ exports.extract = function (cwd, opts) { var onlink = function () { if (win32) return next() // skip links on win for now before it can be tested - // Commented out vulnerable code. - // xfs.unlink(name, function () { - // var srcpath = path.resolve(cwd, header.linkname) - - // xfs.link(srcpath, name, function (err) { - // if (err && err.code === 'EPERM' && opts.hardlinkAsFilesFallback) { - // stream = xfs.createReadStream(srcpath) - // return onfile() - // } - - // stat(err) - // }) - // }) + xfs.unlink(name, function () { + var srcpath = path.resolve(cwd, header.linkname) + + xfs.link(srcpath, name, function (err) { + if (err && err.code === 'EPERM' && opts.hardlinkAsFilesFallback) { + stream = xfs.createReadStream(srcpath) + return onfile() + } + + stat(err) + }) + }) } var onfile = function () {