From 6767d04a1d89a3666403172079f1b69ec9eb121c Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 10 May 2013 13:41:13 +0200 Subject: Fix #2295 (sanitize commands given to /help) remove starting slashes and starting and trailing spaces --- src/core.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/core.py b/src/core.py index 6766ef6a..d57605fa 100644 --- a/src/core.py +++ b/src/core.py @@ -1362,15 +1362,17 @@ class Core(object): msg = '\n'.join(buff) msg += _("\nType /help to know what each command does") if args: - if args[0] in self.commands: - tup = self.commands[args[0]] - elif args[0] in self.current_tab().commands: - tup = self.current_tab().commands[args[0]] + command = args[0].lstrip('/').strip() + + if command in self.commands: + tup = self.commands[command] + elif command in self.current_tab().commands: + tup = self.current_tab().commands[command] else: - self.information(_('Unknown command: %s') % args[0], 'Error') + self.information(_('Unknown command: %s') % command, 'Error') return if isinstance(tup, Command): - msg = _('Usage: /%s %s\n' % (args[0], tup.usage)) + msg = _('Usage: /%s %s\n' % (command, tup.usage)) msg += tup.desc else: msg = tup[1] -- cgit v1.2.3