From a9ce1dfc0c3463607fe3bf339c88d087e0649a83 Mon Sep 17 00:00:00 2001 From: Mauricio Schneider Date: Fri, 27 Mar 2015 08:35:13 -0300 Subject: [PATCH 1/3] Replace newlines with spaces so messages can fit the alert ui. Fix #112 --- lib/agent/actions/alert/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/agent/actions/alert/index.js b/lib/agent/actions/alert/index.js index aba65a5a1..b6af04421 100644 --- a/lib/agent/actions/alert/index.js +++ b/lib/agent/actions/alert/index.js @@ -48,6 +48,9 @@ exports.start = function(opts, cb) { emitter = null; } + // remove newlines so the message can be completely displayed + message = message.replace(/(\r\n|\n|\r)/gm," "); + args.push(message); system.spawn_as_logged_user(bin, args, function(err, alert) { if (err) return done(err); From af8452d19d64007a0bc94f3bb25896c58003e09f Mon Sep 17 00:00:00 2001 From: Mauricio Schneider Date: Tue, 7 Apr 2015 15:50:13 -0300 Subject: [PATCH 2/3] Add missing g modifier to sanitizing regex in network module for mac. Fix #117 --- lib/agent/providers/network/mac.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/agent/providers/network/mac.js b/lib/agent/providers/network/mac.js index 4b8db9b75..e7fa76ea7 100644 --- a/lib/agent/providers/network/mac.js +++ b/lib/agent/providers/network/mac.js @@ -64,7 +64,7 @@ exports.parse_access_points_list = function(stdout) { var sec = end[1] && end[1].trim(); var ap = { - ssid : start[0].trim().replace(/[^\w :'-]/, ''), // remove weird chars + ssid : start[0].trim().replace(/[^\w :'-]/g, ''), // remove weird chars mac_address : line.match(mac_address_regex)[0], signal_strength : parseInt(data[1]), // use positive integers channel : parseInt(data[2]), From 6338bd65950b35a574867b955048856b6c7a4c60 Mon Sep 17 00:00:00 2001 From: Mauricio Schneider Date: Tue, 7 Apr 2015 16:20:15 -0300 Subject: [PATCH 3/3] Add missing g modifier to windows and linux access points list parser --- lib/agent/providers/network/linux.js | 2 +- lib/agent/providers/network/windows.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/agent/providers/network/linux.js b/lib/agent/providers/network/linux.js index 2f5c840bb..63aba58dc 100644 --- a/lib/agent/providers/network/linux.js +++ b/lib/agent/providers/network/linux.js @@ -104,7 +104,7 @@ exports.parse_access_points_list = function(output) { return; var obj = { - ssid: parsed['ESSID'].slice(1, -1).replace(/[^\w :'-]/, ''), // remove "" and weird chars, + ssid: parsed['ESSID'].slice(1, -1).replace(/[^\w :'-]/g, ''), // remove "" and weird chars, mac_address: parsed['Address'], security: parsed['Encryption key'] == 'on' } diff --git a/lib/agent/providers/network/windows.js b/lib/agent/providers/network/windows.js index 21d99cf48..a81c56c77 100644 --- a/lib/agent/providers/network/windows.js +++ b/lib/agent/providers/network/windows.js @@ -99,7 +99,7 @@ exports.parse_access_points_list_autowc = function(out) { return arr.map(function(o) { return { - ssid : o.ssid.replace(/[^\w :'-]/, ''), + ssid : o.ssid.replace(/[^\w :'-]/g, ''), // security : null, // don't have this data // quality : null, signal_strength : o.signal_strength,