mirror of https://github.com/fail2ban/fail2ban
`splitwords` (used by ignoreip etc) considers now any kind of space as valid separator (also tabs) besides comma;
closes gh-3562pull/3564/head
parent
bcaf1e714e
commit
bbca81f34c
|
@ -284,7 +284,7 @@ def splitwords(s):
|
|||
"""
|
||||
if not s:
|
||||
return []
|
||||
return list(filter(bool, [v.strip() for v in re.split('[ ,\n]+', s)]))
|
||||
return list(filter(bool, [v.strip() for v in re.split('[\s,]+', s)]))
|
||||
|
||||
def _merge_dicts(x, y):
|
||||
"""Helper to merge dicts.
|
||||
|
|
|
@ -66,8 +66,7 @@ class HelpersTest(unittest.TestCase):
|
|||
self.assertEqual(splitwords(' 1, 2 , '), ['1', '2'])
|
||||
self.assertEqual(splitwords(' 1\n 2'), ['1', '2'])
|
||||
self.assertEqual(splitwords(' 1\n 2, 3'), ['1', '2', '3'])
|
||||
# string as unicode:
|
||||
self.assertEqual(splitwords(' 1\n 2, 3'), ['1', '2', '3'])
|
||||
self.assertEqual(splitwords('\t1\t 2,\r\n 3\n'), ['1', '2', '3']); # other spaces
|
||||
|
||||
|
||||
def _sh_call(cmd):
|
||||
|
|
Loading…
Reference in New Issue