regex filter fix

This commit is contained in:
Erik 2021-06-09 04:00:01 +03:00
parent 64641ab517
commit 7964573beb
No known key found for this signature in database
GPG Key ID: 7E862371D3409F16

View File

@ -77,8 +77,9 @@ module.exports = class WordFilter extends FilterSetting {
} else if (['explicit', 'fuzzy', 'regex', 'whitelist'].includes(method)) { } else if (['explicit', 'fuzzy', 'regex', 'whitelist'].includes(method)) {
if (method === 'regex') args = args.map((arg) => Util.sanitiseRegex(arg)); const [first, ...rest] = args; // First arg should skip sanitisation
const resolved = await resolver.resolveMethod(args, { if (method === 'regex') args = rest.map((arg) => Util.sanitiseRegex(arg));
const resolved = await resolver.resolveMethod([first, ...args], {
existing: setting[method], existing: setting[method],
allowedMethods: ['add', 'remove', 'set', 'reset'] allowedMethods: ['add', 'remove', 'set', 'reset']
}); });