mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 07:46:16 -04:00
Added tests + fixes for PR
- actually removed prev func - shuffled some stuff around
This commit is contained in:
parent
9161cc693d
commit
6698a2ac13
4 changed files with 49 additions and 9 deletions
|
@ -458,6 +458,9 @@ const StrUtils = {
|
|||
{"escaped": "\\\"", "unescaped": "\""},
|
||||
{"escaped": "\\n", "unescaped": "\n"},
|
||||
{"escaped": "\\r", "unescaped": "\r"},
|
||||
{"escaped": "\\t", "unescaped": "\t"},
|
||||
{"escaped": "\\b", "unescaped": "\b"},
|
||||
{"escaped": "\\f", "unescaped": "\f"},
|
||||
],
|
||||
|
||||
/**
|
||||
|
@ -497,7 +500,7 @@ const StrUtils = {
|
|||
* World`
|
||||
*/
|
||||
runUnescape: function(input, args) {
|
||||
return StrUtils._replaceByKeys(Utils.parseEscapedChars(input), "escaped", "unescaped");
|
||||
return StrUtils._replaceByKeys(input, "escaped", "unescaped");
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -514,6 +517,7 @@ const StrUtils = {
|
|||
*/
|
||||
_replaceByKeys: function(input, patternKey, replacementKey) {
|
||||
let output = input;
|
||||
if (patternKey === "escaped") output = Utils.parseEscapedChars(input); // I've wrapped this to catch the \\x encoded characters
|
||||
StrUtils.ESCAPE_REPLACEMENTS.forEach(replacement => {
|
||||
output = output.split(replacement[patternKey]).join(replacement[replacementKey]);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue