trailing / indicates a directory when type is 0. fixes #43
This commit is contained in:
parent
02bbe131f2
commit
f5daa7b167
1 changed files with 3 additions and 1 deletions
|
@ -191,7 +191,6 @@ exports.encode = function(opts) {
|
|||
|
||||
exports.decode = function(buf) {
|
||||
var typeflag = buf[156] === 0 ? 0 : buf[156] - ZERO_OFFSET
|
||||
var type = toType(typeflag)
|
||||
|
||||
var name = decodeStr(buf, 0, 100)
|
||||
var mode = decodeOct(buf, 100)
|
||||
|
@ -207,6 +206,9 @@ exports.decode = function(buf) {
|
|||
|
||||
if (buf[345]) name = decodeStr(buf, 345, 155)+'/'+name
|
||||
|
||||
// to support old tar versions that use trailing / to indicate dirs
|
||||
if (typeflag === 0 && name && name[name.length - 1] === '/') typeflag = 5
|
||||
|
||||
var c = cksum(buf)
|
||||
|
||||
//checksum is still initial value if header was null.
|
||||
|
|
Loading…
Reference in a new issue