From: Carl Worth Date: Wed, 21 Oct 2020 18:46:09 +0000 (-0700) Subject: Dont' allow hunt_id to contain a hyphen X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=927e8b6b801b6649a8947490c6a394bcb23d414c;p=turbot 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. --- 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" } }) }