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 @@ -272,13 +272,17 @@ exports.extract = function (cwd, opts) {
272272 xfs . unlink ( name , function ( ) {
273273 var srcpath = path . join ( cwd , path . join ( '/' , header . linkname ) )
274274
275- xfs . link ( srcpath , name , function ( err ) {
276- if ( err && err . code === 'EPERM' && opts . hardlinkAsFilesFallback ) {
277- stream = xfs . createReadStream ( srcpath )
278- return onfile ( )
279- }
275+ xfs . realpath ( srcpath , function ( err , dst ) {
276+ if ( err || ! dst . startsWith ( path . resolve ( cwd ) ) ) return next ( new Error ( name + ' is not a valid hardlink' ) )
280277
281- stat ( err )
278+ xfs . link ( dst , name , function ( err ) {
279+ if ( err && err . code === 'EPERM' && opts . hardlinkAsFilesFallback ) {
280+ stream = xfs . createReadStream ( srcpath )
281+ return onfile ( )
282+ }
283+
284+ stat ( err )
285+ } )
282286 } )
283287 } )
284288 }
You can’t perform that action at this time.
0 commit comments