Skip to content

Commit

Permalink
fix: issue with edge case escape character, enhance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eshaz committed Jan 13, 2024
1 parent d105f30 commit 3f87552
Show file tree
Hide file tree
Showing 7 changed files with 182 additions and 151 deletions.
2 changes: 1 addition & 1 deletion dist/esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-yenc",
"version": "1.0.3",
"version": "1.0.4",
"description": "Minimalist yEnc and dynEncode encoder and decoder library for browser and NodeJS",
"main": "./dist/index.js",
"module": "./dist/esm.js",
Expand Down
4 changes: 2 additions & 2 deletions src/simple-yenc.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ const dynamicEncode = (
}

// correct edge case where escape character is at end of string
if (charArray[charArray.length - 1] === "\\" && shouldEscape(92)) {
if (charArray[charArray.length - 1] === "\\") {
charArray.pop();
escapeCharacter("\\", charArray);
escapeCharacter(92, charArray);
}

return charArray.join("");
Expand Down
Binary file modified test/offset_test.bin
Binary file not shown.
Loading

0 comments on commit 3f87552

Please sign in to comment.