diff --git a/src/views/network.js b/src/views/network.js index 80c107e8c..a1b15a337 100644 --- a/src/views/network.js +++ b/src/views/network.js @@ -82,7 +82,11 @@ angular.module('Application').controller('NetworkController', ['$scope', '$locat $scope.blocklist.error = {}; $scope.blocklist.busy = true; - var blocklist = $scope.blocklist.blocklist.split('\n').filter(function (x) { return x !== ''; }); + // remove empty and dedupe array + var blocklist = $scope.blocklist.blocklist.split('\n') + .map(function (ip) { return ip.trim(); }) + .filter(function (ip) { return ip !== ''; }) + .filter(function(item, pos, self) { return self.indexOf(item) == pos; }); Client.setBlocklist(blocklist, function (error) { $scope.blocklist.busy = false;