Repository: oppia/oppia

Issue:
Search input filter in collection editor might be catching valid names.
In the search bar in the collection editor, currently the regex allows "A-Za-z0-9-_ ". But when an exploration is selected from the dropdown it is displayed as "Name (explorationID)". On trying to make further edits to the search bar the bar is highlighted in red ( as '(' and ')') are invalid characters as per the regex. 
One of the demo explorations has title "Welcome to Oppia!" where '!' is not an allowed character in the title field. This is not being caught by the title validators. This also is shown up in red in the search field. 

Expected Behavior: The input field does not turn red for valid inputs

Search input filter in collection editor might be catching valid names.
In the search bar in the collection editor, currently the regex allows "A-Za-z0-9-_ ". But when an exploration is selected from the dropdown it is displayed as "Name (explorationID)". On trying to make further edits to the search bar the bar is highlighted in red ( as '(' and ')') are invalid characters as per the regex. 
One of the demo explorations has title "Welcome to Oppia!" where '!' is not an allowed character in the title field. This is not being caught by the title validators. This also is shown up in red in the search field. 

Expected Behavior: The input field does not turn red for valid inputs



Discussion:
We(me & @nithusha21) tried to investigate this and come up with a reasonable fix, here's the rough transcript:
- As per the python code, it(title) accepts anything except ":#/|_%<>[]{} "
- So overall we have to add exploration ids filter & title filter regEx validator in collection search bar.
- So I think now we have to include this filter in search bar validator and if possible we have to change the warning message for title validator of exploration.

//cc @nithusha21 
Hi @DubeySandeep , after some discussion with the other TL's, let's make it so that the search query gets base64 encoded on the front-end and then have the back-end decode it (in collection_editor.ExplorationMetadataSearchHandler). This way, the search query can be anything. Does that sounds good?
We(me & @nithusha21) tried to investigate this and come up with a reasonable fix, here's the rough transcript:
- As per the python code, it(title) accepts anything except ":#/|_%<>[]{} "
- So overall we have to add exploration ids filter & title filter regEx validator in collection search bar.
- So I think now we have to include this filter in search bar validator and if possible we have to change the warning message for title validator of exploration.

//cc @nithusha21 
Hi @DubeySandeep , after some discussion with the other TL's, let's make it so that the search query gets base64 encoded on the front-end and then have the back-end decode it (in collection_editor.ExplorationMetadataSearchHandler). This way, the search query can be anything. Does that sounds good?

Resolving patch:
diff --git a/core/controllers/collection_editor.py b/core/controllers/collection_editor.py
--- a/core/controllers/collection_editor.py
+++ b/core/controllers/collection_editor.py
@@ -16,6 +16,8 @@
 
 """Controllers for the collections editor."""
 
+import base64
+
 from core.controllers import base
 from core.domain import acl_decorators
 from core.domain import collection_services
@@ -234,7 +236,7 @@ class ExplorationMetadataSearchHandler(base.BaseHandler):
     @acl_decorators.open_access
     def get(self):
         """Handles GET requests."""
-        query_string = self.request.get('q')
+        query_string = base64.b64decode(self.request.get('q'))
 
         search_cursor = self.request.get('cursor', None)
 


Test patch: