mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 06:55:08 -04:00
Merge 347979a9f4
into 7c8be12d52
This commit is contained in:
commit
5546fb9b5d
1 changed files with 9 additions and 2 deletions
|
@ -23,7 +23,13 @@ class URLDecode extends Operation {
|
||||||
this.infoURL = "https://wikipedia.org/wiki/Percent-encoding";
|
this.infoURL = "https://wikipedia.org/wiki/Percent-encoding";
|
||||||
this.inputType = "string";
|
this.inputType = "string";
|
||||||
this.outputType = "string";
|
this.outputType = "string";
|
||||||
this.args = [];
|
this.args = [
|
||||||
|
{
|
||||||
|
"name": "Treat \"+\" as space",
|
||||||
|
"type": "boolean",
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
|
];
|
||||||
this.checks = [
|
this.checks = [
|
||||||
{
|
{
|
||||||
pattern: ".*(?:%[\\da-f]{2}.*){4}",
|
pattern: ".*(?:%[\\da-f]{2}.*){4}",
|
||||||
|
@ -39,7 +45,8 @@ class URLDecode extends Operation {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
run(input, args) {
|
run(input, args) {
|
||||||
const data = input.replace(/\+/g, "%20");
|
const plusIsSpace = args[0];
|
||||||
|
const data = plusIsSpace ? input.replace(/\+/g, "%20") : input;
|
||||||
try {
|
try {
|
||||||
return decodeURIComponent(data);
|
return decodeURIComponent(data);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue