From 6608ec66b58f94aa1c1a71f8024fc9cf7ca623f9 Mon Sep 17 00:00:00 2001 From: Dedmen Miller Date: Sat, 4 Jan 2020 23:57:16 +0100 Subject: [PATCH 1/3] Don't decode when URL has no encoded characters --- addons/strings/fnc_decodeURL.sqf | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/strings/fnc_decodeURL.sqf b/addons/strings/fnc_decodeURL.sqf index d1e67eb52..a4ca66156 100644 --- a/addons/strings/fnc_decodeURL.sqf +++ b/addons/strings/fnc_decodeURL.sqf @@ -28,11 +28,13 @@ private _return = _cache getVariable _string; if (isNil "_return") then { _return = _string; - - { - _return = ([_return] + _x) call CBA_fnc_replace; - } forEach UTF8_TABLE; - + + //Only need to check if there is atleast one character to replace in the stirng + if ("%" in _return) then { + { + _return = ([_return] + _x) call CBA_fnc_replace; + } forEach UTF8_TABLE; + } if (isNull _cache) then { _cache = [] call CBA_fnc_createNamespace; missionNamespace setVariable [QGVAR(URLCache), _cache]; From be49df6148d1e59c6bac111ece325fd7520f9b1e Mon Sep 17 00:00:00 2001 From: Dedmen Miller Date: Sun, 5 Jan 2020 01:15:06 +0100 Subject: [PATCH 2/3] Fix missing semicolon Co-Authored-By: commy2 --- addons/strings/fnc_decodeURL.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/strings/fnc_decodeURL.sqf b/addons/strings/fnc_decodeURL.sqf index a4ca66156..64f32037f 100644 --- a/addons/strings/fnc_decodeURL.sqf +++ b/addons/strings/fnc_decodeURL.sqf @@ -34,7 +34,7 @@ if (isNil "_return") then { { _return = ([_return] + _x) call CBA_fnc_replace; } forEach UTF8_TABLE; - } + }; if (isNull _cache) then { _cache = [] call CBA_fnc_createNamespace; missionNamespace setVariable [QGVAR(URLCache), _cache]; From 19bdcd8dec20917e2e22bd40b4698a5414e606cc Mon Sep 17 00:00:00 2001 From: Dedmen Miller Date: Sun, 5 Jan 2020 01:15:19 +0100 Subject: [PATCH 3/3] Better comment Co-Authored-By: jonpas --- addons/strings/fnc_decodeURL.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/strings/fnc_decodeURL.sqf b/addons/strings/fnc_decodeURL.sqf index 64f32037f..a98f91bd7 100644 --- a/addons/strings/fnc_decodeURL.sqf +++ b/addons/strings/fnc_decodeURL.sqf @@ -29,7 +29,7 @@ private _return = _cache getVariable _string; if (isNil "_return") then { _return = _string; - //Only need to check if there is atleast one character to replace in the stirng + // Only replace if there is at least one character to replace if ("%" in _return) then { { _return = ([_return] + _x) call CBA_fnc_replace;