From 138b2615ea5b43d6ce9c3f05b84277b39a06e9b5 Mon Sep 17 00:00:00 2001 From: mh2k9 Date: Mon, 4 Dec 2017 12:44:15 +0600 Subject: [PATCH 1/2] Fixing Uncaught URIError: URI malformed --- iron-query-params.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/iron-query-params.html b/iron-query-params.html index 635f5d7..63d0fbf 100644 --- a/iron-query-params.html +++ b/iron-query-params.html @@ -89,8 +89,15 @@ for (var i = 0; i < paramList.length; i++) { var param = paramList[i].split('='); if (param[0]) { - params[decodeURIComponent(param[0])] = - decodeURIComponent(param[1] || ''); + let key, value; + try { + key = param[0].replace(/%([^\d].)/, "%25$1"); + value = param[1].replace(/%([^\d].)/, "%25$1"); + params[decodeURIComponent(key)] = decodeURIComponent(value || ''); + params[decodeURIComponent(key)] = decodeURIComponent(value || ''); + } catch (e) { + // console.log(e.message); + } } } return params; From 27bb73b0e5ade8ca58959f0af826c1f2d7d79fdb Mon Sep 17 00:00:00 2001 From: mh2k9 Date: Mon, 4 Dec 2017 12:46:49 +0600 Subject: [PATCH 2/2] Update iron-query-params.html --- iron-query-params.html | 1 - 1 file changed, 1 deletion(-) diff --git a/iron-query-params.html b/iron-query-params.html index 63d0fbf..fe0e704 100644 --- a/iron-query-params.html +++ b/iron-query-params.html @@ -94,7 +94,6 @@ key = param[0].replace(/%([^\d].)/, "%25$1"); value = param[1].replace(/%([^\d].)/, "%25$1"); params[decodeURIComponent(key)] = decodeURIComponent(value || ''); - params[decodeURIComponent(key)] = decodeURIComponent(value || ''); } catch (e) { // console.log(e.message); }