From 6425bd75cb7d6f019929cb03fc0faa946440fdab Mon Sep 17 00:00:00 2001 From: Dave C-J Date: Sat, 9 Nov 2013 17:12:19 +0000 Subject: [PATCH] Make bad word filter only operate on strings - drop anything else. --- analysis/swearfilter/74-swearfilter.html | 4 ++-- analysis/swearfilter/74-swearfilter.js | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/analysis/swearfilter/74-swearfilter.html b/analysis/swearfilter/74-swearfilter.html index fd0abeb5..69f01bfd 100644 --- a/analysis/swearfilter/74-swearfilter.html +++ b/analysis/swearfilter/74-swearfilter.html @@ -22,7 +22,8 @@ diff --git a/analysis/swearfilter/74-swearfilter.js b/analysis/swearfilter/74-swearfilter.js index f8b445b3..29ba7534 100644 --- a/analysis/swearfilter/74-swearfilter.js +++ b/analysis/swearfilter/74-swearfilter.js @@ -14,15 +14,16 @@ * limitations under the License. **/ -var RED = require(process.env.NODE_RED_HOME+"/red/red"); +var RED = require("../../red/red"); var badwords = require('badwords'); function BadwordsNode(n) { RED.nodes.createNode(this,n); var node = this; this.on("input", function(msg) { - if (badwords.ok(msg.payload)) { node.send(msg); } + if (typeof msg.payload == "string") { + if (badwords.ok(msg.payload)) { node.send(msg); } + } }); } - RED.nodes.registerType("badwords",BadwordsNode);