From a6a6e73b0463a03f8f189f43309ad170a2a91205 Mon Sep 17 00:00:00 2001 From: Emma Triphora Date: Sat, 6 May 2023 14:56:47 -0400 Subject: [PATCH] Revert "Fix lint issues (#1126)" This reverts commit 521e21072ed00ca97dc102919fbcb6d17e08f6c5. --- helpers/parse.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/helpers/parse.js b/helpers/parse.js index e6cb4e63..1a0df2aa 100644 --- a/helpers/parse.js +++ b/helpers/parse.js @@ -42,25 +42,22 @@ export const configuredXss = new xss.FilterXSS({ for (const source of allowedSources) { if (source.regex.test(value)) { for (const remove of source.remove) { - let index = value.indexOf(remove) + let index = value.indexOf(remove); do { if (index - 1 > 0 && value.charAt(index - 1) === '?') { // need to watch out for two things // case where its ?stand=alone // case where its ?followed=by&another=queryParam - if ( - index + remove.length < value.length && - value.charAt(index + remove.length) === '&' - ) { - value = value.replace(`${remove}&`, '') + if (index + remove.length < value.length && value.charAt(index + remove.length) === '&') { + value = value.replace(`${remove}&`, ''); } else if (index + remove.length >= value.length) { - value = value.replace(`?${remove}`, '') + value = value.replace(`?${remove}`, ''); } } else { - value = value.replaceAll(`&${remove}`, '') // can safely be removed + value = value.replaceAll(`&${remove}`, ''); // can safely be removed } - index = value.indexOf(remove) - } while (index !== -1) + index = value.indexOf(remove); + } while (index !== -1); } return name + '="' + xss.escapeAttrValue(value) + '"' }