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 3f4057b commit 1fa9e05
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,18 +260,20 @@ exports.extract = function (cwd, opts) {

var onlink = function () {
if (win32) return next() // skip links on win for now before it can be tested
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)
})
})

// 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)
// })
// })
}

var onfile = function () {
Expand Down

0 comments on commit 1fa9e05

Please sign in to comment.