Repair error in encoder contents extraction.

This commit is contained in:
Tony Garnock-Jones 2021-12-09 21:25:27 +01:00
parent 57c66f81b1
commit 2ff4e88822
1 changed files with 6 additions and 2 deletions

View File

@ -83,7 +83,9 @@ export class EncoderState {
return new Bytes(this.view.buffer.slice(0, resultLength)); return new Bytes(this.view.buffer.slice(0, resultLength));
} else { } else {
this.rotatebuffer(4096); this.rotatebuffer(4096);
return Bytes.concat(this.chunks); const chunks = this.chunks;
this.chunks = [];
return Bytes.concat(chunks);
} }
} }
@ -95,7 +97,9 @@ export class EncoderState {
return s; return s;
} else { } else {
this.rotatebuffer(4096); this.rotatebuffer(4096);
return this.chunks.map(asLatin1).join(''); const chunks = this.chunks;
this.chunks = [];
return chunks.map(asLatin1).join('');
} }
} }