Merge pull request #54 from piranna/master

Ensure packed symlinks have size zero as required by GNU `tar`
This commit is contained in:
Mathias Buus 2016-04-19 15:10:29 +02:00
commit 449a70b3e3
2 changed files with 3 additions and 2 deletions

View file

@ -117,7 +117,7 @@ Pack.prototype.entry = function (header, buffer, callback) {
var self = this var self = this
if (!header.size) header.size = 0 if (!header.size || header.type === 'symlink') header.size = 0
if (!header.type) header.type = modeToType(header.mode) if (!header.type) header.type = modeToType(header.mode)
if (!header.mode) header.mode = header.type === 'directory' ? DMODE : FMODE if (!header.mode) header.mode = header.type === 'directory' ? DMODE : FMODE
if (!header.uid) header.uid = 0 if (!header.uid) header.uid = 0

View file

@ -110,7 +110,8 @@ test('types', function (t) {
uname: 'maf', uname: 'maf',
gname: 'staff', gname: 'staff',
uid: 501, uid: 501,
gid: 20 gid: 20,
size: 9 // Should convert to zero
}) })
pack.finalize() pack.finalize()