bugfix for method being added into word list

This commit is contained in:
Erik 2021-06-10 01:14:51 +03:00
parent c317641dce
commit 03f39baf0d
No known key found for this signature in database
GPG Key ID: 7E862371D3409F16

View File

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