Comparing version 3.0.6 to 3.0.7
15
index.js
@@ -123,2 +123,4 @@ const tar = require('tar-stream') | ||
cwd = path.resolve(cwd) | ||
const xfs = opts.fs || fs | ||
@@ -220,2 +222,5 @@ const ignore = opts.ignore || opts.filter || noop | ||
xfs.unlink(name, function () { | ||
const dst = path.resolve(path.dirname(name), header.linkname) | ||
if (!inCwd(dst)) return next(new Error(name + ' is not a valid symlink')) | ||
xfs.symlink(header.linkname, name, stat) | ||
@@ -228,7 +233,7 @@ }) | ||
xfs.unlink(name, function () { | ||
const srcpath = path.join(cwd, path.join('/', header.linkname)) | ||
const dst = path.join(cwd, path.join('/', header.linkname)) | ||
xfs.link(srcpath, name, function (err) { | ||
xfs.link(dst, name, function (err) { | ||
if (err && err.code === 'EPERM' && opts.hardlinkAsFilesFallback) { | ||
stream = xfs.createReadStream(srcpath) | ||
stream = xfs.createReadStream(dst) | ||
return onfile() | ||
@@ -242,2 +247,6 @@ } | ||
function inCwd (dst) { | ||
return dst.startsWith(cwd) | ||
} | ||
function onfile () { | ||
@@ -244,0 +253,0 @@ const ws = xfs.createWriteStream(name) |
{ | ||
"name": "tar-fs", | ||
"version": "3.0.6", | ||
"version": "3.0.7", | ||
"description": "filesystem bindings for tar-stream", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
17112
299