Ensure packed symlinks have size zero as required by GNU tar

This commit is contained in:
Jesús Leganés Combarro "piranna 2016-04-19 14:52:43 +02:00
parent 71439bf2df
commit bbb3e91a44
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
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.mode) header.mode = header.type === 'directory' ? DMODE : FMODE
if (!header.uid) header.uid = 0

View file

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