From fb4e07f107a7aa6fedfea2356e43b1af019fa438 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sun, 11 Feb 2018 08:46:59 -0500 Subject: [PATCH] fix regression reported at https://www.wilderssecurity.com/threads/umatrix-the-http-switchboard-successor.369601/page-27#post-2737419 --- src/js/matrix.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/js/matrix.js b/src/js/matrix.js index 5aa78aa..2a4486c 100644 --- a/src/js/matrix.js +++ b/src/js/matrix.js @@ -685,9 +685,8 @@ Matrix.prototype.fromLine = function(line) { let field0 = fields[0]; // Switches - let pos = field0.indexOf(':'); - if ( pos !== -1 ) { - let switchName = field0.slice(0, pos); + if ( this.reSwitchRule.test(field0) ) { + let switchName = field0.slice(0, -1); let srcHostname = punycode.toASCII(fields[1]); let state = fields[2]; if ( @@ -736,6 +735,8 @@ Matrix.prototype.fromLine = function(line) { return true; }; +Matrix.prototype.reSwitchRule = /^[0-9a-z-]+:$/; + /******************************************************************************/ Matrix.prototype.toSelfie = function() {