From 95d5fd1789fd378ac3fcc1d99d90eea6f71b4a31 Mon Sep 17 00:00:00 2001 From: es45411 <135977478+es45411@users.noreply.github.com> Date: Mon, 12 May 2025 13:09:49 +0000 Subject: [PATCH] Add treat space as plus URLDecode option --- src/core/operations/URLDecode.mjs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/core/operations/URLDecode.mjs b/src/core/operations/URLDecode.mjs index 7d6544ac..bb6c0612 100644 --- a/src/core/operations/URLDecode.mjs +++ b/src/core/operations/URLDecode.mjs @@ -23,7 +23,13 @@ class URLDecode extends Operation { this.infoURL = "https://wikipedia.org/wiki/Percent-encoding"; this.inputType = "string"; this.outputType = "string"; - this.args = []; + this.args = [ + { + "name": "Treat \"+\" as space", + "type": "boolean", + "value": true + }, + ]; this.checks = [ { pattern: ".*(?:%[\\da-f]{2}.*){4}", @@ -39,7 +45,8 @@ class URLDecode extends Operation { * @returns {string} */ run(input, args) { - const data = input.replace(/\+/g, "%20"); + const plusIsSpace = args[0]; + const data = plusIsSpace ? input.replace(/\+/g, "%20") : input; try { return decodeURIComponent(data); } catch (err) {