Permalink
Browse files

Merge pull request #8 from jergason/patch-2

Fix bugs with this identifier and out array expansion
  • Loading branch information...
2 parents fb15e86 + c1a6934 commit f28fe10f6b91708b711d0c55b4c60a9e740853af @beatgammit committed Oct 28, 2011
Showing with 5 additions and 4 deletions.
  1. +5 −4 lib/tar.js
View
@@ -80,9 +80,10 @@
this.written += headerArr.length;
- // this makes sense if the input is greater than 512 bytes
- if (headerArr.length + input.length > this.out.length) {
- this.out = utils.extend(this.out, headerArr.length, input.length, blockSize);
+ // If there is not enough space in this.out, we need to expand it to
+ // fit the new input.
+ if (this.written + input.length > this.out.length) {
+ this.out = utils.extend(this.out, this.written, input.length, blockSize);
}
this.out.set(input, this.written);
@@ -92,7 +93,7 @@
// make sure there's at least 2 empty records worth of extra space
if (this.out.length - this.written < recordSize * 2) {
- this.out = utils.extend(out, this.written, recordSize * 2, blockSize);
+ this.out = utils.extend(this.out, this.written, recordSize * 2, blockSize);
}
if (typeof callback === 'function') {

0 comments on commit f28fe10

Please sign in to comment.