Skip to content

Commit 663b39c

Browse files
authored
Split token file by any whitespace after the colon, not just a space
With the current parser logic, only tokens and servers that are separated by _exactly_ a colon and a space `: ` are detected as tokens. But when formatting one's token file with tabs, this breaks. This commit changes the split characters to be a regular expression that matches all forms of whitespace, including spaces and tabs.
1 parent 86a20b2 commit 663b39c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

websockify/token_plugins.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import print_function
22
import os
33
import sys
4+
import re
45

56
class BasePlugin(object):
67
def __init__(self, src):
@@ -31,7 +32,7 @@ def _load_targets(self):
3132
for line in [l.strip() for l in open(f).readlines()]:
3233
if line and not line.startswith('#'):
3334
try:
34-
tok, target = line.split(': ')
35+
tok, target = re.split(':\s', line)
3536
self._targets[tok] = target.strip().rsplit(':', 1)
3637
except ValueError:
3738
print >>sys.stderr, "Syntax error in %s on line %d" % (self.source, index)

0 commit comments

Comments
 (0)