mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 23:06:16 -04:00
Fixed bugs in pretty recipe format generation
This commit is contained in:
parent
6fbb2f26d1
commit
512487328d
2 changed files with 9 additions and 8 deletions
|
@ -903,9 +903,9 @@ const Utils = {
|
||||||
* "Pretty" CyberChef recipe formats are designed to be included in the fragment (#) or query (?)
|
* "Pretty" CyberChef recipe formats are designed to be included in the fragment (#) or query (?)
|
||||||
* parts of the URL. They can also be loaded into CyberChef through the 'Load' interface. In order
|
* parts of the URL. They can also be loaded into CyberChef through the 'Load' interface. In order
|
||||||
* to make this format as readable as possible, various special characters are used unescaped. This
|
* to make this format as readable as possible, various special characters are used unescaped. This
|
||||||
* reduces the amount of percent-encoding included in the URL which is typically difficult to read,
|
* reduces the amount of percent-encoding included in the URL which is typically difficult to read
|
||||||
* as well as substantially increasing the overall length. These characteristics can be quite
|
* and substantially increases the overall length. These characteristics can be quite off-putting
|
||||||
* offputting for users.
|
* for users.
|
||||||
*
|
*
|
||||||
* @param {Object[]} recipeConfig
|
* @param {Object[]} recipeConfig
|
||||||
* @param {boolean} newline - whether to add a newline after each operation
|
* @param {boolean} newline - whether to add a newline after each operation
|
||||||
|
@ -922,12 +922,11 @@ const Utils = {
|
||||||
name = op.op.replace(/ /g, "_");
|
name = op.op.replace(/ /g, "_");
|
||||||
args = JSON.stringify(op.args)
|
args = JSON.stringify(op.args)
|
||||||
.slice(1, -1) // Remove [ and ] as they are implied
|
.slice(1, -1) // Remove [ and ] as they are implied
|
||||||
// We now need to switch double-quoted (") strings to single-quotes (') as these do not
|
// We now need to switch double-quoted (") strings to single quotes (') as single quotes
|
||||||
// need to be percent-encoded.
|
// do not need to be percent-encoded.
|
||||||
.replace(/'/g, "\\'") // Escape single quotes
|
.replace(/'/g, "\\'") // Escape single quotes
|
||||||
.replace(/\\"/g, '"') // Unescape double quotes
|
.replace(/"((?:[^"\\]|\\.)*)"/g, "'$1'") // Replace opening and closing " with '
|
||||||
.replace(/(^|,|{|:)"/g, "$1'") // Replace opening " with '
|
.replace(/\\"/g, '"'); // Unescape double quotes
|
||||||
.replace(/"(,|:|}|$)/g, "'$1"); // Replace closing " with '
|
|
||||||
|
|
||||||
disabled = op.disabled ? "/disabled": "";
|
disabled = op.disabled ? "/disabled": "";
|
||||||
bp = op.breakpoint ? "/breakpoint" : "";
|
bp = op.breakpoint ? "/breakpoint" : "";
|
||||||
|
|
|
@ -443,6 +443,7 @@ App.prototype.getRecipeConfig = function() {
|
||||||
/**
|
/**
|
||||||
* Given a recipe configuration, sets the recipe to that configuration.
|
* Given a recipe configuration, sets the recipe to that configuration.
|
||||||
*
|
*
|
||||||
|
* @fires Manager#statechange
|
||||||
* @param {Object[]} recipeConfig - The recipe configuration
|
* @param {Object[]} recipeConfig - The recipe configuration
|
||||||
*/
|
*/
|
||||||
App.prototype.setRecipeConfig = function(recipeConfig) {
|
App.prototype.setRecipeConfig = function(recipeConfig) {
|
||||||
|
@ -487,6 +488,7 @@ App.prototype.setRecipeConfig = function(recipeConfig) {
|
||||||
|
|
||||||
// Unpause auto bake
|
// Unpause auto bake
|
||||||
this.autoBakePause = false;
|
this.autoBakePause = false;
|
||||||
|
window.disptchEent(this.manager.statechange);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue