Socket
Socket
Sign inDemoInstall

tar

Package Overview
Dependencies
Maintainers
2
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tar - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

17

lib/extract.js

@@ -20,3 +20,2 @@ // give it a tarball and a path, and it'll dump the contents

opts.path = opts.path || path.resolve("node-tar-extract")
// have to dump into a directory
opts.type = "Directory"

@@ -48,15 +47,15 @@ opts.Directory = true

}
if (entry.type === "Link") {
entry.linkpath = entry.props.linkpath = path.join(
opts.path, path.join("/", entry.props.linkpath)
)
entry.linkpath = entry.props.linkpath =
path.join(opts.path, path.join("/", entry.props.linkpath))
}
if (entry.props && entry.props.linkpath) {
if (entry.type === "SymbolicLink") {
var dn = path.dirname(entry.path) || ""
var linkpath = entry.props.linkpath
// normalize paths that point outside the extraction root
if (path.resolve(opts.path, linkpath).indexOf(opts.path) !== 0) {
entry.props.linkpath = path.join(opts.path, path.join("/", linkpath))
var target = path.resolve(opts.path, dn, linkpath)
if (target.indexOf(opts.path) !== 0) {
linkpath = path.join(opts.path, path.join("/", linkpath))
}
entry.linkpath = entry.props.linkpath = linkpath
}

@@ -63,0 +62,0 @@ })

@@ -5,3 +5,3 @@ {

"description": "tar for node",
"version": "2.0.0",
"version": "2.0.1",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",

@@ -19,18 +19,33 @@ // Set the umask, so that it works the same everywhere.

type: '5',
depth: undefined,
size: 0,
linkpath: '',
nlink: undefined,
dev: undefined,
ino: undefined
linkpath: ''
},
{ path: 'fixtures/a/',
mode: '755',
type: '5',
linkpath: ''
},
{ path: 'fixtures/the-chumbler',
mode: '755',
type: '2',
depth: undefined,
size: 0,
linkpath: path.resolve(target, 'a/b/c/d/the-chumbler'),
nlink: undefined,
dev: undefined,
ino: undefined
},
{ path: 'fixtures/a/b/',
mode: '755',
type: '5',
linkpath: ''
},
{ path: 'fixtures/a/x',
mode: '644',
type: '0',
linkpath: ''
},
{ path: 'fixtures/a/b/c/',
mode: '755',
type: '5',
linkpath: ''
},
{ path: 'fixtures/a/b/c/y',
mode: '755',
type: '2',
linkpath: '../../x',
}

@@ -53,2 +68,32 @@ ]

},
{ path: '/fixtures/a',
mode: '40755',
type: 'Directory',
depth: 2,
linkpath: undefined
},
{ path: '/fixtures/a/b',
mode: '40755',
type: 'Directory',
depth: 3,
linkpath: undefined
},
{ path: '/fixtures/a/b/c',
mode: '40755',
type: 'Directory',
depth: 4,
linkpath: undefined
},
{ path: '/fixtures/a/b/c/y',
mode: '120755',
type: 'SymbolicLink',
depth: 5,
linkpath: '../../x'
},
{ path: '/fixtures/a/x',
mode: '100644',
type: 'File',
depth: 3,
linkpath: undefined
},
{ path: '/fixtures/the-chumbler',

@@ -58,5 +103,3 @@ mode: '120755',

depth: 2,
size: 95,
linkpath: path.resolve(target, 'a/b/c/d/the-chumbler'),
nlink: 1
linkpath: path.resolve(target, 'a/b/c/d/the-chumbler')
}

@@ -90,17 +133,12 @@ ]

extract.on('entry', function (entry) {
var mode = entry.props.mode & (~parseInt('22', 8))
var found = {
path: entry.path,
mode: entry.props.mode.toString(8),
mode: mode.toString(8),
type: entry.props.type,
depth: entry.props.depth,
size: entry.props.size,
linkpath: entry.props.linkpath,
nlink: entry.props.nlink,
dev: entry.props.dev,
ino: entry.props.ino
}
var wanted = expectEntries[ee++]
t.equivalent(found, wanted, 'tar entry ' + ee + ' ' + wanted.path)
t.equivalent(found, wanted, 'tar entry ' + ee + ' ' + (wanted && wanted.path))
})

@@ -123,16 +161,14 @@

var p = entry.path.substr(target.length)
var mode = entry.props.mode & (~parseInt('22', 8))
var found = {
path: p,
mode: entry.props.mode.toString(8),
mode: mode.toString(8),
type: entry.props.type,
depth: entry.props.depth,
size: entry.props.size,
linkpath: entry.props.linkpath,
nlink: entry.props.nlink
linkpath: entry.props.linkpath
}
var wanted = expectFiles[ef++]
t.equivalent(found, wanted, 'unpacked file ' + ef + ' ' + (wanted && wanted.path))
t.has(found, wanted, 'unpacked file ' + ef + ' ' + wanted.path)
entry.on('entry', foundEntry)

@@ -139,0 +175,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc