diff --git a/parsing.py b/parsing.py index 93bdf4cbe1..1848f3140c 100644 --- a/parsing.py +++ b/parsing.py @@ -134,6 +134,7 @@ def url_to_shortlink(url): def preprocess_shortcut_command(cmd): + cmd = regex.sub(r"(\d)\s+", r"\1", cmd) parts = cmd.split(" ") new_cmd = ["sd"] for i in range(1, len(parts)): diff --git a/test/test_parsing.py b/test/test_parsing.py index d6a42e932a..42bba7bbc9 100644 --- a/test/test_parsing.py +++ b/test/test_parsing.py @@ -39,6 +39,8 @@ ('sd tpu fp ignore delete', preprocess_shortcut_command, 'sd tpu fp ignore delete'), ('sd 5-', preprocess_shortcut_command, 'sd - - - - -'), ('sd tpu', preprocess_shortcut_command, 'sd tpu'), + ('sd 2 tpu', preprocess_shortcut_command, 'sd tpu tpu'), + ('sd fp 3 tpu', preprocess_shortcut_command, 'sd fp tpu tpu tpu'), (test_data_inputs[0], fetch_post_id_and_site_from_msg_content, ('246651', 'meta.stackexchange.com', 'question')), (test_data_inputs[0], fetch_owner_url_from_msg_content, 'http://meta.stackexchange.com/users/279263/lisa-usher'), (test_data_inputs[0], fetch_title_from_msg_content, 'Best Weight Loss Tips For Fast Results'),