Fix #66 - invalid pax header when length+digits is 100 (#77)

This commit is contained in:
Bruno Michel 2017-11-13 12:28:54 +01:00 committed by Mathias Buus
parent c5f214402d
commit 6d1dadd0bf

View file

@ -156,7 +156,7 @@ var decodeStr = function (val, offset, length) {
var addLength = function (str) {
var len = Buffer.byteLength(str)
var digits = Math.floor(Math.log(len) / Math.log(10)) + 1
if (len + digits > Math.pow(10, digits)) digits++
if (len + digits >= Math.pow(10, digits)) digits++
return (len + digits) + str
}