From 7ef49b15d64f450a0449a05a3c27d9804dcfde74 Mon Sep 17 00:00:00 2001 From: Tim Windelschmidt Date: Tue, 27 Sep 2016 21:50:18 +0200 Subject: [PATCH] Added very ugly hack for removing the " Char --- node/routes/index.js | 2 +- node/snmp-mac.js | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/node/routes/index.js b/node/routes/index.js index b4d55b7..e98fa9e 100755 --- a/node/routes/index.js +++ b/node/routes/index.js @@ -31,7 +31,7 @@ exports.form = function (req, res) { res.redirect("/db"); } } else if (action == "remove") { - console.log("remove mac request mac: "+mac + " label " + '"' + label + '"' + " ip: " + ip); + console.log("remove mac request mac: "+mac + " label " + label + " ip: " + ip); snmpMac.delete(mac, function (err) { console.log("delete mac result: " + err); req.flash('status', err == null ? "" : "database error: " + err); diff --git a/node/snmp-mac.js b/node/snmp-mac.js index f3e718e..4268a48 100644 --- a/node/snmp-mac.js +++ b/node/snmp-mac.js @@ -62,7 +62,15 @@ var SnmpMac = function(hostname, community) { // console.log(mac); redisClient.get(redisprefix + mac, function(err, reply) { if(reply != null) { - names.push(reply); + if (reply.split('')[0] == '"' && reply.split('')[reply.split('').length] == '"') { + var name = ""; + for (var i = 1; i < reply.split('').length - 1; i++){ + name += reply.split('')[i] + } + names.push() + } else { + names.push(reply); + } } }); });