From f64a1fa25dbf9dea1254d22e1dbd44115317eb97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sun, 31 May 2020 14:40:15 +0200 Subject: [PATCH] fix: redundant calls of decodeURIComponent --- static/formica.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/static/formica.html b/static/formica.html index 938db40e..5ad9c481 100644 --- a/static/formica.html +++ b/static/formica.html @@ -23,7 +23,7 @@ parts.forEach((item, index) => { parts = item.split('='); - settings[parts[0]] = decodeURIComponent(parts[1]); + settings[parts[0]] = decodeURIComponent(parts[1] || '').trim(); }); } @@ -156,8 +156,8 @@ const main = () => { if (!settings.s || !settings.l) return; - _siteUri = decodeURIComponent(settings.s); - _sourceUri = decodeURIComponent(settings.l); + _siteUri = settings.s; + _sourceUri = settings.l; if (!_siteUri || !_sourceUri) return; @@ -169,7 +169,7 @@ return addImage(_sourceUri); } - const customCookie = decodeURIComponent(settings.k || ''); + const customCookie = settings.k; const data = { url: _sourceUri, @@ -182,11 +182,11 @@ const content = result.content; let text = ''; - if (settings.c) text = decodeURIComponent(settings.c).trim(); + if (settings.c) text = settings.c.trim(); if (error) { text = `[${text}](${_sourceUri})`; - if (settings.r) text += ` _(via ${decodeURIComponent(settings.r)})_.`; + if (settings.r) text += ` _(via ${settings.r})_.`; global.text.value = text; return feedback(null, 'Could not fetch URL; are you logged in?'); } @@ -214,7 +214,7 @@ text = `[${text}](${_sourceUri})`; - if (settings.r) text += ` _(via ${decodeURIComponent(settings.r)})_.`; + if (settings.r) text += ` _(via ${settings.r})_.`; global.title.value = openGraphTitle || sourceDocument.title; global.text.value = text;