From 927e8b6b801b6649a8947490c6a394bcb23d414c Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 21 Oct 2020 11:46:09 -0700 Subject: [PATCH] Dont' allow hunt_id to contain a hyphen We're planning to use a hyphen in the puzzles' channel names to separate the hunt_id from the rest of the puzzle's channel name, so the hunt_id itself must not contain any hyphen. --- turbot/actions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/turbot/actions.py b/turbot/actions.py index 911367e..700a7b4 100644 --- a/turbot/actions.py +++ b/turbot/actions.py @@ -43,7 +43,7 @@ def new_hunt_submission(turb, payload): url = state['url']['url']['value'] # Validate that the hunt_id contains no invalid characters - if not re.match(r'[-_a-zA-Z0-9]+$', hunt_id): + if not re.match(r'[_a-zA-Z0-9]+$', hunt_id): print("Hunt ID field is invalid. Attmpting to return a clean error.") return { 'statusCode': 200, @@ -54,7 +54,7 @@ def new_hunt_submission(turb, payload): "response_action": "errors", "errors": { "hunt_id": "Hunt ID can only contain letters, " - + "numbers, hyphens and underscores" + + "numbers, and underscores" } }) } -- 2.45.2