matrix-org / mjolnir

A moderation tool for Matrix
Apache License 2.0
328 stars 55 forks source link

Fails on start with empty protections.wordlist.words list #81

Open MurzNN opened 3 years ago

MurzNN commented 3 years ago

Describe the bug When the protections.wordlist.words list is empty in YAML config file, mjolnir failts to start with this error:

mjolnir/lib/protections/WordList.js:35
         this.badWords = new RegExp("(" + config_1.default.protections.wordlist.words.join(")|(") + ")", "i");
TypeError: Cannot read property 'join' of null

To Reproduce Steps to reproduce the behavior:

  1. Comment-out all lines from protections.wordlist.words values in example config.
  2. Try to start mjolnir

Expected behavior Empty list should be treated as empty, without fatal errors.

hanseartic commented 3 years ago

as a quick-fix you can assign an empt array: protections.wordlist.words: []