]> git.cworth.org Git - turbot/commitdiff
Don't allow capital letters in a hunt or puzzle ID
authorCarl Worth <cworth@cworth.org>
Fri, 23 Oct 2020 00:25:48 +0000 (17:25 -0700)
committerCarl Worth <cworth@cworth.org>
Fri, 23 Oct 2020 00:25:48 +0000 (17:25 -0700)
Since Slack won't allow them in a channel name.

turbot/interaction.py

index 18dc4d253a1daa8edbf0d4c64cbe4190e6922512..d745a7a3e1428f3e7b75d7dc6e8192123f7fc9ba 100644 (file)
@@ -12,8 +12,8 @@ actions = {}
 commands = {}
 submission_handlers = {}
 
-# Hunt and Puzzle IDs are restricted to letters, numbers, and underscores
-valid_id_re = r'^[_a-zA-Z0-9]+$'
+# Hunt/Puzzle IDs are restricted to lowercase letters, numbers, and underscores
+valid_id_re = r'^[_a-z0-9]+$'
 
 def bot_reply(message):
     """Construct a return value suitable for a bot reply
@@ -92,7 +92,7 @@ def new_hunt_submission(turb, payload, metadata):
     # Validate that the hunt_id contains no invalid characters
     if not re.match(valid_id_re, hunt_id):
         return submission_error("hunt_id",
-                                "Hunt ID can only contain letters, "
+                                "Hunt ID can only contain lowercase letters, "
                                 + "numbers, and underscores")
 
     # Check to see if the hunts table exists
@@ -342,7 +342,7 @@ def puzzle_submission(turb, payload, metadata):
     # Validate that the puzzle_id contains no invalid characters
     if not re.match(valid_id_re, puzzle_id):
         return submission_error("puzzle_id",
-                                "Puzzle ID can only contain letters, "
+                                "Puzzle ID can only contain lowercase letters, "
                                 + "numbers, and underscores")
 
     # Create a channel for the puzzle