Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
psmyrek authored Jul 25, 2024
1 parent 1fa9e05 commit 67c25be
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit 67c25be

Please sign in to comment.