mirror of
https://github.com/fail2ban/fail2ban.git
synced 2026-03-11 08:55:31 +00:00
splitwords (used by ignoreip etc) considers now any kind of space as valid separator (also tabs) besides comma;
closes gh-3562
This commit is contained in:
parent
bcaf1e714e
commit
bbca81f34c
2 changed files with 2 additions and 3 deletions
|
|
@ -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 a new issue