mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-23 19:19:31 +01:00
parse_message_args: remove extraneous \'s that aren't escaping characters
This commit is contained in:
parent
aba198dbd6
commit
943168df53
@ -150,14 +150,18 @@ class IRCCommonProtocol(IRCNetwork):
|
||||
if data[0].startswith('@'):
|
||||
tagdata = data[0].lstrip('@').split(';')
|
||||
for idx, tag in enumerate(tagdata):
|
||||
tag = tag.replace(r'\s', ' ')
|
||||
tag = tag.replace(r'\\', '\\')
|
||||
tag = tag.replace(r'\r', '\r')
|
||||
tag = tag.replace(r'\n', '\n')
|
||||
tag = tag.replace(r'\:', ';')
|
||||
tag = tag.replace('\\s', ' ')
|
||||
tag = tag.replace('\\r', '\r')
|
||||
tag = tag.replace('\\n', '\n')
|
||||
tag = tag.replace('\\:', ';')
|
||||
|
||||
# We want to drop lone \'s but keep \\ as \ ...
|
||||
tag = tag.replace('\\\\', '\x00')
|
||||
tag = tag.replace('\\', '')
|
||||
tag = tag.replace('\x00', '\\')
|
||||
tagdata[idx] = tag
|
||||
|
||||
results = cls.parse_isupport(tagdata, fallback=None)
|
||||
results = cls.parse_isupport(tagdata, fallback='')
|
||||
return results
|
||||
return {}
|
||||
|
||||
|
@ -46,7 +46,8 @@ class MessageParserTest(unittest.TestCase):
|
||||
# method that relies on command handlers being present. So we can't reasonably test
|
||||
# them here (plus handle_events() outputs params as a command-specific dict instead of)
|
||||
# lists)
|
||||
self.assertEqual(atoms['tags'], IRCCommonProtocol.parse_message_tags(inp.split(" ")))
|
||||
self.assertEqual(atoms['tags'], IRCCommonProtocol.parse_message_tags(inp.split(" ")),
|
||||
"Parse test failed for message tags: %r" % inp)
|
||||
_, inp = inp.split(" ", 1)
|
||||
if has_source:
|
||||
parts = IRCCommonProtocol.parse_prefixed_args(inp)
|
||||
|
Loading…
Reference in New Issue
Block a user