File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -265,13 +265,17 @@ exports.extract = function (cwd, opts) {
265265 xfs . unlink ( name , function ( ) {
266266 var srcpath = path . join ( cwd , path . join ( '/' , header . linkname ) )
267267
268- xfs . link ( srcpath , name , function ( err ) {
269- if ( err && err . code === 'EPERM' && opts . hardlinkAsFilesFallback ) {
270- stream = xfs . createReadStream ( srcpath )
271- return onfile ( )
272- }
268+ xfs . realpath ( srcpath , function ( err , dst ) {
269+ if ( err || ! dst . startsWith ( path . resolve ( cwd ) ) ) return next ( new Error ( name + ' is not a valid hardlink' ) )
273270
274- stat ( err )
271+ xfs . link ( dst , name , function ( err ) {
272+ if ( err && err . code === 'EPERM' && opts . hardlinkAsFilesFallback ) {
273+ stream = xfs . createReadStream ( srcpath )
274+ return onfile ( )
275+ }
276+
277+ stat ( err )
278+ } )
275279 } )
276280 } )
277281 }
You can’t perform that action at this time.
0 commit comments