Skip to content

Commit

Permalink
Fix snapshot report merging
Browse files Browse the repository at this point in the history
Rename `newLength` to `checkPosition` to make the function clearer.
At the end of the loop `checkPosition` points to the last index that
does not contain a line ending, so add one to include it.

Fixes #1848
  • Loading branch information
coreyfarrell authored and novemberborn committed Jul 13, 2018
1 parent fd73358 commit 223f992
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/snapshot-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ function tryRead(file) {
}

function withoutLineEndings(buffer) {
let newLength = buffer.byteLength - 1;
while (buffer[newLength] === 0x0A || buffer[newLength] === 0x0D) {
newLength--;
let checkPosition = buffer.byteLength - 1;
while (buffer[checkPosition] === 0x0A || buffer[checkPosition] === 0x0D) {
checkPosition--;
}
return buffer.slice(0, newLength);
return buffer.slice(0, checkPosition + 1);
}

function formatEntry(label, descriptor) {
Expand Down

0 comments on commit 223f992

Please sign in to comment.