zcommand: Raise error when command doesn't begin with a slash.

This commit is contained in:
Rhea Parekh
2018-06-21 22:53:35 +05:30
committed by showell
parent b22d266667
commit fdef1d8d91
2 changed files with 7 additions and 1 deletions

View File

@@ -6,7 +6,9 @@ from zerver.lib.actions import do_set_user_display_setting
from zerver.lib.exceptions import JsonableError
def process_zcommands(content: str, user_profile: UserProfile) -> Dict[str, Any]:
command = content.replace('/', '')
if not content.startswith('/'):
raise JsonableError(_('There should be a leading slash in the zcommand.'))
command = content[1:]
if command == 'ping':
ret = dict() # type: Dict[str, Any]