Skip to content

Commit

Permalink
Fix header decoding sometimes failing in the browser (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrederikBolding committed Jan 19, 2024
1 parent 03da589 commit 298d3d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions headers.js
Expand Up @@ -34,7 +34,7 @@ exports.decodePax = function decodePax (buf) {
while (buf.length) {
let i = 0
while (i < buf.length && buf[i] !== 32) i++
const len = parseInt(buf.subarray(0, i).toString(), 10)
const len = parseInt(b4a.toString(buf.subarray(0, i)), 10)
if (!len) return result

const b = b4a.toString(buf.subarray(i + 1, len - 1))
Expand Down Expand Up @@ -304,7 +304,7 @@ function decodeOct (val, offset, length) {
const end = clamp(indexOf(val, 32, offset, val.length), val.length, val.length)
while (offset < end && val[offset] === 0) offset++
if (end === offset) return 0
return parseInt(val.subarray(offset, end).toString(), 8)
return parseInt(b4a.toString(val.subarray(offset, end)), 8)
}
}

Expand Down

0 comments on commit 298d3d4

Please sign in to comment.