]> git.cworth.org Git - turbot/commitdiff
Dont' allow hunt_id to contain a hyphen
authorCarl Worth <cworth@cworth.org>
Wed, 21 Oct 2020 18:46:09 +0000 (11:46 -0700)
committerCarl Worth <cworth@cworth.org>
Wed, 21 Oct 2020 18:46:09 +0000 (11:46 -0700)
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

index 911367e2b63d1ff6a3d3d960c2357148d81b0265..700a7b49c62cdba9d8c91ee331606b64daa03acc 100644 (file)
@@ -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"
                 }
             })
         }