Skip to content

Commit

Permalink
feat: Computing the slice bounds in the appropriate way
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
ViBiOh committed Nov 5, 2022
1 parent 672a08f commit 90e5e05
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/fibr/static/scripts/async-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function findIndexEscapeSequence(escapeSequence, content) {
escapePosition++;

if (escapePosition === escapeSequence.length) {
return i;
return i - (escapeSequence.length - 1);
}
} else if (escapePosition !== 0) {
escapePosition = 0;
Expand Down Expand Up @@ -74,7 +74,7 @@ async function* readChunk(response) {

while (endPosition !== -1) {
yield part.slice(0, endPosition);
part = part.slice(endPosition + (escapeSequence.length - 2));
part = part.slice(endPosition + escapeSequence.length);

endPosition = findIndexEscapeSequence(escapeSequence, part);
}
Expand Down
Loading

0 comments on commit 90e5e05

Please sign in to comment.