Skip to content

Commit fb4e07f

Browse files
committed
1 parent 429af12 commit fb4e07f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/js/matrix.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,9 +685,8 @@ Matrix.prototype.fromLine = function(line) {
685685
let field0 = fields[0];
686686

687687
// Switches
688-
let pos = field0.indexOf(':');
689-
if ( pos !== -1 ) {
690-
let switchName = field0.slice(0, pos);
688+
if ( this.reSwitchRule.test(field0) ) {
689+
let switchName = field0.slice(0, -1);
691690
let srcHostname = punycode.toASCII(fields[1]);
692691
let state = fields[2];
693692
if (
@@ -736,6 +735,8 @@ Matrix.prototype.fromLine = function(line) {
736735
return true;
737736
};
738737

738+
Matrix.prototype.reSwitchRule = /^[0-9a-z-]+:$/;
739+
739740
/******************************************************************************/
740741

741742
Matrix.prototype.toSelfie = function() {

0 commit comments

Comments
 (0)