From 7964573beb82e83cbfeca4bfa7c31b2a8d951e2c Mon Sep 17 00:00:00 2001 From: Navy Date: Wed, 9 Jun 2021 04:00:01 +0300 Subject: [PATCH] regex filter fix --- .../client/components/settings/moderation/WordFilter.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/structure/client/components/settings/moderation/WordFilter.js b/structure/client/components/settings/moderation/WordFilter.js index b222772..e274a24 100644 --- a/structure/client/components/settings/moderation/WordFilter.js +++ b/structure/client/components/settings/moderation/WordFilter.js @@ -77,8 +77,9 @@ module.exports = class WordFilter extends FilterSetting { } else if (['explicit', 'fuzzy', 'regex', 'whitelist'].includes(method)) { - if (method === 'regex') args = args.map((arg) => Util.sanitiseRegex(arg)); - const resolved = await resolver.resolveMethod(args, { + const [first, ...rest] = args; // First arg should skip sanitisation + if (method === 'regex') args = rest.map((arg) => Util.sanitiseRegex(arg)); + const resolved = await resolver.resolveMethod([first, ...args], { existing: setting[method], allowedMethods: ['add', 'remove', 'set', 'reset'] });